61 lines
2.9 KiB
Go
61 lines
2.9 KiB
Go
package seriessetmaster
|
|
|
|
import "time"
|
|
|
|
// SeriesSetMaster merepresentasikan tabel utama "series_set_masters" di database (digunakan untuk AutoMigrate GORM)
|
|
type SeriesSetMaster struct {
|
|
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
|
|
ParentID *uint `json:"parent_id" gorm:"index;default:null"`
|
|
SetCode string `json:"set_code,omitempty" gorm:"type:varchar(50);index"`
|
|
SetName string `json:"set_name,omitempty" gorm:"type:varchar(150)"`
|
|
SeriesName string `json:"series_name" gorm:"type:varchar(150);not null;index"`
|
|
Image string `json:"image" gorm:"type:varchar(255)"`
|
|
Logo string `json:"logo,omitempty" gorm:"type:varchar(255)"`
|
|
ReleaseDate *time.Time `json:"release_date,omitempty" gorm:"type:date"`
|
|
TotalCards int `json:"total_cards" gorm:"default:0"`
|
|
ExpansionCount int `json:"expansion_count" gorm:"default:0"`
|
|
CardCount int `json:"card_count" gorm:"default:0"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
CreatedBy *uint `json:"created_by" gorm:"default:null"`
|
|
UpdatedBy *uint `json:"updated_by" gorm:"default:null"`
|
|
Parent *SeriesSetMaster `json:"parent,omitempty" gorm:"foreignKey:ParentID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
|
|
Children []SeriesSetMaster `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID"`
|
|
}
|
|
|
|
func (SeriesSetMaster) TableName() string {
|
|
return "series_set_masters"
|
|
}
|
|
|
|
// Series merepresentasikan data khusus Series untuk kelola data/response
|
|
type Series struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
Image string `json:"image"`
|
|
ExpansionCount int `json:"expansion_count"`
|
|
CardCount int `json:"card_count"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
CreatedBy *uint `json:"created_by"`
|
|
UpdatedBy *uint `json:"updated_by"`
|
|
Sets []Set `json:"sets,omitempty"`
|
|
}
|
|
|
|
// Set merepresentasikan data khusus Set untuk kelola data/response
|
|
type Set struct {
|
|
ID uint `json:"id"`
|
|
ParentID uint `json:"parent_id"`
|
|
SetCode string `json:"set_code"`
|
|
SetName string `json:"set_name"`
|
|
SeriesName string `json:"series_name"`
|
|
Image string `json:"image"`
|
|
Logo string `json:"logo,omitempty"`
|
|
ReleaseDate *time.Time `json:"release_date,omitempty"`
|
|
TotalCards int `json:"total_cards"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
CreatedBy *uint `json:"created_by"`
|
|
UpdatedBy *uint `json:"updated_by"`
|
|
Series *Series `json:"series,omitempty"`
|
|
}
|