43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package models
|
|
|
|
type PoolCategory string
|
|
|
|
const (
|
|
Series PoolCategory = "series"
|
|
Collection PoolCategory = "collection"
|
|
)
|
|
|
|
type Pool struct {
|
|
BaseModel[PoolID]
|
|
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"`
|
|
}
|
|
|
|
func (Pool) TableName() string {
|
|
return "Pool"
|
|
}
|
|
|
|
type PoolPost struct {
|
|
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"`
|
|
}
|
|
|
|
func (PoolPost) TableName() string {
|
|
return "PoolPost"
|
|
}
|
|
|
|
type PoolReference struct {
|
|
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"`
|
|
}
|
|
|
|
func (PoolReference) TableName() string {
|
|
return "PoolReference"
|
|
}
|