Interactive/pkg/models/articles.go

41 lines
926 B
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"`
Reactions []Reaction `json:"reactions"`
Description string `json:"description"`
Content string `json:"content"`
RealmID *uint `json:"realm_id"`
Realm *Realm `json:"realm"`
2024-03-02 17:23:11 +00:00
Comments []Comment `json:"comments" gorm:"foreignKey:ArticleID"`
}
2024-03-03 14:57:17 +00:00
func (p *Article) GetReplyTo() PostInterface {
2024-03-02 17:23:11 +00:00
return nil
}
2024-03-03 14:57:17 +00:00
func (p *Article) GetRepostTo() PostInterface {
2024-03-02 17:23:11 +00:00
return nil
}
2024-03-03 14:57:17 +00:00
func (p *Article) GetHashtags() []Tag {
2024-03-02 17:23:11 +00:00
return p.Hashtags
}
2024-03-03 14:57:17 +00:00
func (p *Article) GetCategories() []Category {
2024-03-02 17:23:11 +00:00
return p.Categories
}
2024-03-03 14:57:17 +00:00
func (p *Article) SetHashtags(tags []Tag) {
2024-03-02 17:23:11 +00:00
p.Hashtags = tags
}
2024-03-03 14:57:17 +00:00
func (p *Article) SetCategories(categories []Category) {
2024-03-02 17:23:11 +00:00
p.Categories = categories
}