✨ Language's post
This commit is contained in:
@ -13,6 +13,7 @@ type Article struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Content string `json:"content"`
|
||||
Language string `json:"language"`
|
||||
Tags []Tag `json:"tags" gorm:"many2many:article_tags"`
|
||||
Categories []Category `json:"categories" gorm:"many2many:article_categories"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
@ -26,7 +27,5 @@ type Article struct {
|
||||
AuthorID uint `json:"author_id"`
|
||||
Author Account `json:"author"`
|
||||
|
||||
// Dynamic Calculated Values
|
||||
ReactionCount int64 `json:"reaction_count"`
|
||||
ReactionList map[string]int64 `json:"reaction_list" gorm:"-"`
|
||||
Metric PostMetric `json:"metric" gorm:"-"`
|
||||
}
|
||||
|
7
pkg/internal/models/metrics.go
Normal file
7
pkg/internal/models/metrics.go
Normal file
@ -0,0 +1,7 @@
|
||||
package models
|
||||
|
||||
type PostMetric struct {
|
||||
ReplyCount int64 `json:"reply_count,omitempty"`
|
||||
ReactionCount int64 `json:"reaction_count,omitempty"`
|
||||
ReactionList map[string]int64 `json:"reaction_list,omitempty"`
|
||||
}
|
@ -10,7 +10,8 @@ type Post struct {
|
||||
BaseModel
|
||||
|
||||
Alias string `json:"alias" gorm:"uniqueIndex"`
|
||||
Content string `json:"content"`
|
||||
Content *string `json:"content"`
|
||||
Language string `json:"language"`
|
||||
Tags []Tag `json:"tags" gorm:"many2many:post_tags"`
|
||||
Categories []Category `json:"categories" gorm:"many2many:post_categories"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
@ -29,8 +30,5 @@ type Post struct {
|
||||
AuthorID uint `json:"author_id"`
|
||||
Author Account `json:"author"`
|
||||
|
||||
// Dynamic Calculated Values
|
||||
ReplyCount int64 `json:"reply_count"`
|
||||
ReactionCount int64 `json:"reaction_count"`
|
||||
ReactionList map[string]int64 `json:"reaction_list" gorm:"-"`
|
||||
Metric PostMetric `json:"metric" gorm:"-"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user