package Models
|
|
|
|
import (
|
|
"github.com/gofrs/uuid"
|
|
)
|
|
|
|
type Post struct {
|
|
Base
|
|
Title string `gorm:"not null" json:"title"`
|
|
Content string `gorm:"not null" json:"content"`
|
|
FrontPage bool `gorm:"not null;type:boolean" json:"front_page"`
|
|
Order int `gorm:"not null" json:"order"`
|
|
|
|
PostLinks []PostLink `json:"links"`
|
|
PostImages []PostImage `json:"images"`
|
|
PostVideos []PostVideo `json:"videos"`
|
|
PostAudios []PostAudio `json:"audios"`
|
|
}
|
|
|
|
type PostLinkType string
|
|
|
|
const (
|
|
POST_LINK_FACEBOOK PostLinkType = "Facebook"
|
|
POST_LINK_INSTAGRAM PostLinkType = "Instagram"
|
|
POST_LINK_YOUTUBE PostLinkType = "YouTube"
|
|
POST_LINK_SPOTIFY PostLinkType = "Spotify"
|
|
POST_LINK_OTHER PostLinkType = "Other"
|
|
)
|
|
|
|
type PostLink struct {
|
|
Base
|
|
PostID uuid.UUID `gorm:"type:uuid;column:post_id;not null;" json:"post_id"`
|
|
Link string `gorm:"not null" json:"link"`
|
|
Type PostLinkType `gorm:"not null" json:"type"`
|
|
}
|
|
|
|
type PostImage struct {
|
|
Base
|
|
PostID uuid.UUID `gorm:"type:uuid;column:post_id;not null;" json:"post_id"`
|
|
Filepath string `gorm:"not null" json:"filepath"`
|
|
Mimetype string `gorm:"not null" json:"mimetype"`
|
|
Size int64 `gorm:"not null"`
|
|
}
|
|
|
|
type PostVideo struct {
|
|
Base
|
|
PostID uuid.UUID `gorm:"type:uuid;column:post_id;not null;" json:"post_id"`
|
|
Filepath string `json:"filepath"`
|
|
Mimetype string `json:"mimetype"`
|
|
Size int64 `json:"size"`
|
|
Url string `json:"url"`
|
|
}
|
|
|
|
type PostAudio struct {
|
|
Base
|
|
PostID uuid.UUID `gorm:"type:uuid;column:post_id;not null;" json:"post_id"`
|
|
Filepath string `json:"filepath"`
|
|
Mimetype string `json:"mimetype"`
|
|
Size int64 `json:"size"`
|
|
Url string `json:"url"`
|
|
}
|