2024-10-14 10:23:15 +00:00
|
|
|
package models
|
|
|
|
|
2024-10-14 10:30:27 +00:00
|
|
|
type PoolCategory string
|
|
|
|
|
|
|
|
const (
|
|
|
|
Series PoolCategory = "series"
|
|
|
|
Collection PoolCategory = "collection"
|
|
|
|
)
|
|
|
|
|
2024-10-14 10:23:15 +00:00
|
|
|
type Pool struct {
|
|
|
|
BaseModel[PoolID]
|
2024-10-14 10:30:27 +00:00
|
|
|
Name string `json:"name" gorm:"type:varchar(25)"`
|
|
|
|
Category PoolCategory `json:"category" gorm:"type:pool_category;type:enum('series', 'collection')"`
|
2024-10-14 10:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (Pool) TableName() string {
|
|
|
|
return "Pool"
|
|
|
|
}
|
|
|
|
|
|
|
|
type PoolPost struct {
|
|
|
|
Pool Pool `json:"pool" gorm:"foreignKey:ID;references:PoolID"`
|
|
|
|
PoolID PoolID `json:"pool_id" gorm:""`
|
|
|
|
Post Post `json:"post" gorm:"foreignKey:ID;references:PostID"`
|
|
|
|
PostID PostID `json:"post_id" gorm:""`
|
|
|
|
OrderPosition int `json:"order_position" gorm:"not null;default:0"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (PoolPost) TableName() string {
|
|
|
|
return "PoolPost"
|
|
|
|
}
|
|
|
|
|
|
|
|
type PoolReference struct {
|
|
|
|
Pool Pool `json:"pool" gorm:"foreignKey:ID;references:PoolID"`
|
|
|
|
PoolID PoolID `json:"pool_id" gorm:""`
|
|
|
|
Source Source `json:"source" gorm:"foreignKey:ID;references:SourceID"`
|
|
|
|
SourceID SourceID `json:"source_id" gorm:""`
|
|
|
|
URL string `json:"url" gorm:"not null"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (PoolReference) TableName() string {
|
|
|
|
return "PoolReference"
|
|
|
|
}
|