增加 emoji 表情计数字段

This commit is contained in:
2024-12-21 11:09:56 +08:00
parent a8d1748fc9
commit d0fb0a0c33
4 changed files with 41 additions and 1 deletions

View File

@@ -37,6 +37,11 @@ type Image struct {
User User `json:"user" gorm:"foreignKey:UserID"`
Article Article `json:"article" gorm:"foreignKey:ArticleID"`
Activity bool `json:"activity"`
Emoji1 int `json:"emoji1"`
Emoji2 int `json:"emoji2"`
Emoji3 int `json:"emoji3"`
Emoji4 int `json:"emoji4"`
Emoji5 int `json:"emoji5"`
}
func (Image) TableName() string {
@@ -150,7 +155,12 @@ var imageType = graphql.NewObject(graphql.ObjectConfig{
return p.Source.(Image).Text, nil
},
},
"user": &graphql.Field{Type: userType, Description: "图像所属用户"},
"user": &graphql.Field{Type: userType, Description: "图像所属用户"},
"emoji1": &graphql.Field{Type: graphql.Int, Description: "表情1数量"},
"emoji2": &graphql.Field{Type: graphql.Int, Description: "表情2数量"},
"emoji3": &graphql.Field{Type: graphql.Int, Description: "表情3数量"},
"emoji4": &graphql.Field{Type: graphql.Int, Description: "表情4数量"},
"emoji5": &graphql.Field{Type: graphql.Int, Description: "表情5数量"},
},
})