Interactive/pkg/models/articles.go

42 lines
1.0 KiB
Go
Raw Normal View History

2024-03-02 17:23:11 +00:00
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
}