Interactive/pkg/models/moments.go

41 lines
939 B
Go
Raw Normal View History

2024-03-02 17:23:11 +00:00
package models
type Moment struct {
PostBase
Content string `json:"content"`
Hashtags []Tag `json:"tags" gorm:"many2many:moment_tags"`
Categories []Category `json:"categories" gorm:"many2many:moment_categories"`
Reactions []Reaction `json:"reactions"`
RealmID *uint `json:"realm_id"`
RepostID *uint `json:"repost_id"`
Realm *Realm `json:"realm"`
RepostTo *Moment `json:"repost_to" gorm:"foreignKey:RepostID"`
2024-03-02 17:23:11 +00:00
Comments []Comment `json:"comments" gorm:"foreignKey:MomentID"`
}
2024-03-03 14:57:17 +00:00
func (p *Moment) GetRepostTo() PostInterface {
2024-03-02 17:23:11 +00:00
return p.RepostTo
}
2024-03-03 14:57:17 +00:00
func (p *Moment) GetRealm() *Realm {
2024-03-02 17:23:11 +00:00
return p.Realm
}
2024-03-03 14:57:17 +00:00
func (p *Moment) GetHashtags() []Tag {
2024-03-02 17:23:11 +00:00
return p.Hashtags
}
2024-03-03 14:57:17 +00:00
func (p *Moment) GetCategories() []Category {
2024-03-02 17:23:11 +00:00
return p.Categories
}
2024-03-03 14:57:17 +00:00
func (p *Moment) SetHashtags(tags []Tag) {
2024-03-02 17:23:11 +00:00
p.Hashtags = tags
}
2024-03-03 14:57:17 +00:00
func (p *Moment) SetCategories(categories []Category) {
2024-03-02 17:23:11 +00:00
p.Categories = categories
}