2024-03-02 17:23:11 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
type Moment struct {
|
|
|
|
PostBase
|
|
|
|
|
2024-03-03 04:17:18 +00:00
|
|
|
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
|
|
|
|
}
|