otter-space-sdk/pkg/models/pools.go

43 lines
1.2 KiB
Go
Raw Normal View History

package models
type PoolCategory string
const (
Series PoolCategory = "series"
Collection PoolCategory = "collection"
)
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"`
}
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"`
}
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"`
}
func (PoolReference) TableName() string {
return "PoolReference"
}