Interactive/pkg/models/articles.go

41 lines
920 B
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"`
Reactions []Reaction `json:"reactions"`
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
}