2024-02-02 15:42:42 +00:00
|
|
|
package models
|
|
|
|
|
2024-03-02 17:23:11 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
2024-02-02 15:42:42 +00:00
|
|
|
|
2024-03-02 17:23:11 +00:00
|
|
|
type PostReactInfo struct {
|
|
|
|
PostID uint `json:"post_id"`
|
|
|
|
LikeCount int64 `json:"like_count"`
|
|
|
|
DislikeCount int64 `json:"dislike_count"`
|
|
|
|
ReplyCount int64 `json:"reply_count"`
|
|
|
|
RepostCount int64 `json:"repost_count"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PostBase struct {
|
2024-02-02 15:42:42 +00:00
|
|
|
BaseModel
|
|
|
|
|
2024-03-02 17:23:11 +00:00
|
|
|
Alias string `json:"alias" gorm:"uniqueIndex"`
|
|
|
|
Attachments []Attachment `json:"attachments"`
|
|
|
|
PublishedAt *time.Time `json:"published_at"`
|
|
|
|
|
|
|
|
AuthorID uint `json:"author_id"`
|
|
|
|
Author Account `json:"author"`
|
2024-02-02 16:50:23 +00:00
|
|
|
|
2024-03-03 04:17:18 +00:00
|
|
|
// TODO Give the reactions & replies & reposts info back
|
2024-02-02 15:42:42 +00:00
|
|
|
}
|
2024-03-02 17:23:11 +00:00
|
|
|
|
|
|
|
func (p PostBase) GetID() uint {
|
|
|
|
return p.ID
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p PostBase) GetReplyTo() PostInterface {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p PostBase) GetRepostTo() PostInterface {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p PostBase) GetAuthor() Account {
|
|
|
|
return p.Author
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p PostBase) GetRealm() *Realm {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type PostInterface interface {
|
|
|
|
GetID() uint
|
|
|
|
GetHashtags() []Tag
|
|
|
|
GetCategories() []Category
|
|
|
|
GetReplyTo() PostInterface
|
|
|
|
GetRepostTo() PostInterface
|
|
|
|
GetAuthor() Account
|
|
|
|
GetRealm() *Realm
|
|
|
|
|
|
|
|
SetHashtags([]Tag)
|
|
|
|
SetCategories([]Category)
|
|
|
|
}
|