WIP: Export Kontor DB
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s

This commit is contained in:
Thomas Peetz
2026-10-01 17:40:17 +02:00
parent f5abb44466
commit 4aaf580735
47 changed files with 1101 additions and 369 deletions
+21 -18
View File
@@ -1,6 +1,9 @@
package models
import "time"
import (
"kontor-api-gin/internal/helpers"
"time"
)
type Publisher struct {
ID string `gorm:"type:string;primary_key;"`
@@ -21,28 +24,28 @@ func (publisher *Publisher) TableName() string {
}
type PublisherDTO struct {
ID string `json:"id" binding:"required"`
CreatedAt time.Time `json:"created_date"`
UpdatedAt time.Time `json:"last_modified_date"`
DeletedAt *time.Time `json:"deleted_date,omitempty"`
Version int `json:"version"`
Name string `json:"name"`
WebLink string `json:"weblink"`
ParentPublisherID *string `json:"parent_publisher_id"`
ID string `json:"id" binding:"required"`
CreatedAt helpers.KontorTime `json:"created_date"`
UpdatedAt helpers.KontorTime `json:"last_modified_date"`
DeletedAt *time.Time `json:"deleted_date,omitempty"`
Version int `json:"version"`
Name string `json:"name"`
WebLink string `json:"weblink"`
ParentPublisherID *string `json:"parent_publisher_id"`
}
func ConvertPublishersToDtos(publishers []Publisher) []PublisherDTO {
dtos := make([]PublisherDTO, len(publishers))
for i, comic := range publishers {
for i, publisher := range publishers {
dtos[i] = PublisherDTO{
ID: comic.ID,
CreatedAt: comic.CreatedAt,
UpdatedAt: comic.UpdatedAt,
DeletedAt: comic.DeletedAt,
Version: comic.Version,
Name: comic.Name,
WebLink: comic.WebLink,
ParentPublisherID: comic.ParentPublisherID,
ID: publisher.ID,
CreatedAt: helpers.KontorTime{Time: publisher.CreatedAt},
UpdatedAt: helpers.KontorTime{Time: publisher.UpdatedAt},
DeletedAt: publisher.DeletedAt,
Version: publisher.Version,
Name: publisher.Name,
WebLink: publisher.WebLink,
ParentPublisherID: publisher.ParentPublisherID,
}
}
return dtos