39 lines
1.7 KiB
Go
39 lines
1.7 KiB
Go
package comics
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Comic struct {
|
|
ID string `gorm:"type:string;primary_key;"`
|
|
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"`
|
|
Title string `gorm:"uniqueIndex" json:"title"`
|
|
CurrentOrder bool `gorm:"column:current_order" json:"current_order"`
|
|
Completed bool `gorm:"column:completed" json:"completed"`
|
|
WebLink string `gorm:"column:weblink" json:"weblink"`
|
|
PublisherID *string `gorm:"column:publisher_id" json:"publisher_id"`
|
|
Issues []Issue `gorm:"foreignKey:ComicID"`
|
|
StoryArcs []StoryArc `gorm:"foreignKey:ComicID"`
|
|
TradePaperbacks []TradePaperback `gorm:"foreignKey:ComicID"`
|
|
Volumes []Volume `gorm:"foreignKey:ComicID"`
|
|
ComicWorks []ComicWork `gorm:"foreignKey:ComicID"`
|
|
}
|
|
|
|
func (comic *Comic) TableName() string {
|
|
return "comic"
|
|
}
|
|
|
|
type CreateComicDTO struct {
|
|
Title string `json:"title" binding:"required"`
|
|
}
|
|
|
|
type UpdateComicDTO struct {
|
|
Title *string `json:"title,omitempty" binding:"omitempty"`
|
|
WebLink *string `json:"weblink,omitempty" binding:"omitempty"`
|
|
Completed *bool `json:"cimpleted,omitempty" binding:"omitempty"`
|
|
CurrentOrder *bool `json:"current_order,omitempty" binding:"omitempty"`
|
|
}
|