Count post views

This commit is contained in:
2025-02-17 17:21:15 +08:00
parent 14c17eded8
commit 269e79ca58
11 changed files with 141 additions and 20 deletions

View File

@ -56,8 +56,10 @@ type Post struct {
PublishedAt *time.Time `json:"published_at"`
PublishedUntil *time.Time `json:"published_until"`
TotalUpvote int `json:"total_upvote"`
TotalDownvote int `json:"total_downvote"`
TotalUpvote int `json:"total_upvote"`
TotalDownvote int `json:"total_downvote"`
TotalViews int64 `json:"total_views"`
TotalAggressiveViews int64 `json:"total_aggressive_views"`
PollID *uint `json:"poll_id"`
Poll *Poll `json:"poll"`
@ -111,3 +113,10 @@ type PostInsight struct {
Post Post `json:"post"`
PostID uint `json:"post_id"`
}
type PostView struct {
AccountID uint `json:"account_id" gorm:"primaryKey"`
PostID uint `json:"post_id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}