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-15 13:13:33 +00:00
|
|
|
Name string `json:"name" gorm:"column:name;type:varchar(25)"`
|
|
|
|
Category PoolCategory `json:"category" gorm:"column:category;type:pool_category;type:enum('series', 'collection')"`
|
|
|
|
Posts []PoolPost `json:"posts" gorm:"foreignKey:PoolID"`
|
|
|
|
Sources []PoolReference `json:"sources" gorm:"foreignKey:PoolID"`
|
2024-10-14 10:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (Pool) TableName() string {
|
|
|
|
return "Pool"
|
|
|
|
}
|
|
|
|
|
|
|
|
type PoolPost struct {
|
2024-10-15 13:13:33 +00:00
|
|
|
PoolID PoolID `json:"pool_id" gorm:"column:pool_id;primaryKey"`
|
|
|
|
Pool Pool `json:"-"`
|
|
|
|
PostID PostID `json:"post_id" gorm:"column:post_id;primaryKey"`
|
|
|
|
OrderPosition int `json:"order_position" gorm:"column:order_position;default:0"`
|
2024-10-14 10:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (PoolPost) TableName() string {
|
|
|
|
return "PoolPost"
|
|
|
|
}
|
|
|
|
|
|
|
|
type PoolReference struct {
|
2024-10-15 13:13:33 +00:00
|
|
|
PoolID PoolID `json:"pool_id" gorm:"column:pool_id;primaryKey"`
|
|
|
|
Pool Pool `json:"-"`
|
|
|
|
SourceID SourceID `json:"source_id" gorm:"column:source_id;primaryKey"`
|
|
|
|
URL string `json:"url" gorm:"column:url;primaryKey"`
|
2024-10-14 10:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (PoolReference) TableName() string {
|
|
|
|
return "PoolReference"
|
|
|
|
}
|