Files
CatsOfMastodonGo/internal/domain/post.go

31 lines
1.2 KiB
Go

package domain
type Post struct {
ID string `json:"id" gorm:"primaryKey"`
Url string `json:"url"`
AccountID string // Foreign key field (must match Account.AccId)
Account Account `json:"account" gorm:"foreignKey:AccountID;references:AccId"`
Attachments []MediaAttachment `json:"media_attachments" gorm:"foreignKey:PostID;references:ID;index:idx_post_attachments"`
}
type Account struct {
AccId string `json:"id" gorm:"primaryKey;index"`
Username string `json:"username"`
Acct string `json:"acct"`
DisplayName string `json:"display_name"`
IsBot bool `json:"bot"`
Url string `json:"url"`
AvatarStatic string `json:"avatar_static"`
}
type MediaAttachment struct {
ID string `json:"id" gorm:"primaryKey"`
Type string `json:"type"`
Url string `json:"url"`
PreviewUrl string `json:"preview_url"`
RemoteUrl string `json:"remote_url"`
PostID string `gorm:"index:idx_post_approved,post_id;index:idx_post_id"`
Approved bool `json:"approved" gorm:"index:idx_post_approved"`
Rejected bool `json:"rejected" gorm:"index:idx_post_rejected"`
}