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
+29 -3
View File
@@ -3,16 +3,42 @@ package models
import "time"
type Volume 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"`
Version int `gorm:"default:0" json:"version"`
Name string `gorm:"uniqueIndex" json:"name"`
Name string `gorm:"uniqueIndex" json:"name"`
ComicID *string `gorm:"column:comic_id" json:"comic_id"`
Comic *Comic `gorm:"foreignKey:ComicID"`
Comic *Comic `gorm:"foreignKey:ComicID" json:"comic"`
}
func (volume *Volume) TableName() string {
return "volume"
}
type VolumeDTO 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"`
ComicID *string `json:"comic_id"`
}
func ConvertVolumesToDtos(volumes []Volume) []VolumeDTO {
dtos := make([]VolumeDTO, len(volumes))
for i, volume := range volumes {
dtos[i] = VolumeDTO{
ID: volume.ID,
CreatedAt: volume.CreatedAt,
UpdatedAt: volume.UpdatedAt,
DeletedAt: volume.DeletedAt,
Version: volume.Version,
Name: volume.Name,
ComicID: volume.ComicID,
}
}
return dtos
}