Interactive/pkg/models/articles.go
2024-03-03 01:23:11 +08:00

42 lines
1.0 KiB
Go

package models
type Article struct {
PostBase
Title string `json:"title"`
Hashtags []Tag `json:"tags" gorm:"many2many:article_tags"`
Categories []Category `json:"categories" gorm:"many2many:article_categories"`
LikedAccounts []ArticleLike `json:"liked_accounts"`
DislikedAccounts []ArticleDislike `json:"disliked_accounts"`
Description string `json:"description"`
Content string `json:"content"`
RealmID *uint `json:"realm_id"`
Realm *Realm `json:"realm"`
Comments []Comment `json:"comments" gorm:"foreignKey:ArticleID"`
}
func (p Article) GetReplyTo() PostInterface {
return nil
}
func (p Article) GetRepostTo() PostInterface {
return nil
}
func (p Article) GetHashtags() []Tag {
return p.Hashtags
}
func (p Article) GetCategories() []Category {
return p.Categories
}
func (p Article) SetHashtags(tags []Tag) {
p.Hashtags = tags
}
func (p Article) SetCategories(categories []Category) {
p.Categories = categories
}