Interactive/pkg/models/posts.go

31 lines
1.2 KiB
Go
Raw Normal View History

2024-02-02 15:42:42 +00:00
package models
import "time"
type Post struct {
BaseModel
2024-02-02 16:50:23 +00:00
Content string `json:"content"`
2024-03-02 12:01:59 +00:00
Hashtags []Tag `json:"tags" gorm:"many2many:post_tags"`
2024-02-03 16:24:04 +00:00
Categories []Category `json:"categories" gorm:"many2many:post_categories"`
2024-02-04 10:40:20 +00:00
Attachments []Attachment `json:"attachments"`
2024-02-02 16:50:23 +00:00
LikedAccounts []PostLike `json:"liked_accounts"`
DislikedAccounts []PostDislike `json:"disliked_accounts"`
2024-02-03 07:20:32 +00:00
RepostTo *Post `json:"repost_to" gorm:"foreignKey:RepostID"`
ReplyTo *Post `json:"reply_to" gorm:"foreignKey:ReplyID"`
2024-02-03 11:22:50 +00:00
PinnedAt *time.Time `json:"pinned_at"`
EditedAt *time.Time `json:"edited_at"`
2024-02-02 16:50:23 +00:00
PublishedAt time.Time `json:"published_at"`
2024-02-03 07:20:32 +00:00
RepostID *uint `json:"repost_id"`
ReplyID *uint `json:"reply_id"`
2024-02-02 16:50:23 +00:00
RealmID *uint `json:"realm_id"`
AuthorID uint `json:"author_id"`
Author Account `json:"author"`
// Dynamic Calculating Values
LikeCount int64 `json:"like_count" gorm:"-"`
DislikeCount int64 `json:"dislike_count" gorm:"-"`
2024-02-14 14:30:07 +00:00
ReplyCount int64 `json:"reply_count" gorm:"-"`
RepostCount int64 `json:"repost_count" gorm:"-"`
2024-02-02 15:42:42 +00:00
}