Interactive/pkg/models/comments.go

39 lines
959 B
Go
Raw Normal View History

2024-03-02 17:23:11 +00:00
package models
type Comment struct {
PostBase
Content string `json:"content"`
Hashtags []Tag `json:"tags" gorm:"many2many:comment_tags"`
Categories []Category `json:"categories" gorm:"many2many:comment_categories"`
Reactions []Reaction `json:"reactions"`
Attachments []Attachment `json:"attachments"`
ReplyID *uint `json:"reply_id"`
ReplyTo *Comment `json:"reply_to" gorm:"foreignKey:ReplyID"`
2024-03-02 17:23:11 +00:00
ArticleID *uint `json:"article_id"`
MomentID *uint `json:"moment_id"`
Article *Article `json:"article"`
Moment *Moment `json:"moment"`
}
2024-03-03 14:57:17 +00:00
func (p *Comment) GetReplyTo() PostInterface {
2024-03-02 17:23:11 +00:00
return p.ReplyTo
}
2024-03-03 14:57:17 +00:00
func (p *Comment) GetHashtags() []Tag {
2024-03-02 17:23:11 +00:00
return p.Hashtags
}
2024-03-03 14:57:17 +00:00
func (p *Comment) GetCategories() []Category {
2024-03-02 17:23:11 +00:00
return p.Categories
}
2024-03-03 14:57:17 +00:00
func (p *Comment) SetHashtags(tags []Tag) {
2024-03-02 17:23:11 +00:00
p.Hashtags = tags
}
2024-03-03 14:57:17 +00:00
func (p *Comment) SetCategories(categories []Category) {
2024-03-02 17:23:11 +00:00
p.Categories = categories
}