43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package models
|
|
|
|
type PoolCategory string
|
|
|
|
const (
|
|
Series PoolCategory = "series"
|
|
Collection PoolCategory = "collection"
|
|
)
|
|
|
|
type Pool struct {
|
|
BaseModel[PoolID]
|
|
Name string `json:"name" gorm:"type:varchar(25)"`
|
|
Category PoolCategory `json:"category" gorm:"type:pool_category;type:enum('series', 'collection')"`
|
|
}
|
|
|
|
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"
|
|
}
|