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

This commit is contained in:
Thomas Peetz
2026-09-30 18:55:59 +02:00
parent 914e1214de
commit f5abb44466
52 changed files with 1458 additions and 146 deletions
+36 -4
View File
@@ -3,7 +3,7 @@ package models
import "time"
type Issue struct {
ID string `gorm:"type:string;primary_key;"`
ID string `gorm:"type:string;primary_key;" json:"id"`
CreatedAt time.Time `gorm:"column:created_date" json:"created_date"`
UpdatedAt time.Time `gorm:"column:last_modified_date" json:"last_modified_date"`
DeletedAt *time.Time `gorm:"column:deleted_date" json:"deleted_date"`
@@ -14,13 +14,45 @@ type Issue struct {
Title string `gorm:"column:title" json:"title"`
PublishedOn time.Time `gorm:"column:published_on" json:"published_on"`
ComicID *string `gorm:"column:comic_id" json:"comic_id"`
Comic *Comic `gorm:"foreignKey:ComicID"`
Comic *Comic `gorm:"foreignKey:ComicID" json:"comic"`
StoryArcID *string `gorm:"column:story_arc_id" json:"story_arc_id"`
StoryArc *StoryArc `gorm:"foreignKey:StoryArcID"`
StoryArc *StoryArc `gorm:"foreignKey:StoryArcID" json:"story_arc"`
VolumeID *string `gorm:"column:volume_id" json:"volume_id"`
Volume *Volume `gorm:"foreignKey:VolumeID"`
Volume *Volume `gorm:"foreignKey:VolumeID" json:"volume"`
}
func (issue *Issue) TableName() string {
return "issue"
}
type IssueDTO 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"`
Title string `json:"title"`
PublishedOn time.Time `json:"published_on"`
ComicID *string `json:"comic_id"`
StoryArcID *string `json:"story_arc_id"`
VolumeID *string `json:"volume_id"`
}
func ConvertIssuesToDtos(issues []Issue) []IssueDTO {
dtos := make([]IssueDTO, len(issues))
for i, issue := range issues {
dtos[i] = IssueDTO{
ID: issue.ID,
CreatedAt: issue.CreatedAt,
UpdatedAt: issue.UpdatedAt,
DeletedAt: issue.DeletedAt,
Version: issue.Version,
Title: issue.Title,
PublishedOn: issue.PublishedOn,
ComicID: issue.ComicID,
StoryArcID: issue.StoryArcID,
VolumeID: issue.VolumeID,
}
}
return dtos
}