otter-space-sdk/pkg/models/pools.go
SoXX c120c583e3
All checks were successful
Gitea Build Check / Build (push) Successful in 2m56s
feat(database): added pools
- added migration
- added model
2024-10-14 12:23:15 +02:00

36 lines
1.0 KiB
Go

package models
type Pool struct {
BaseModel[PoolID]
Name string `json:"name" gorm:"type:varchar(25)"`
Category string `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"
}