Skip to content

Commit

Permalink
feat(badge): badge list earned return earned total
Browse files Browse the repository at this point in the history
  • Loading branch information
kumfo committed Sep 2, 2024
1 parent 4f80f9e commit 1666b94
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7793,7 +7793,7 @@ const docTemplate = `{
"description": "badge award count",
"type": "integer"
},
"earned": {
"earned_count": {
"description": "badge earned count",
"type": "integer"
},
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7767,7 +7767,7 @@
"description": "badge award count",
"type": "integer"
},
"earned": {
"earned_count": {
"description": "badge earned count",
"type": "integer"
},
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ definitions:
award_count:
description: badge award count
type: integer
earned:
earned_count:
description: badge earned count
type: integer
icon:
Expand Down
2 changes: 1 addition & 1 deletion internal/schema/badge_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type BadgeListInfo struct {
// badge award count
AwardCount int `json:"award_count" `
// badge earned count
Earned int64 `json:"earned" `
EarnedCount int64 `json:"earned_count" `
// badge level
Level entity.BadgeLevel `json:"level" `
}
Expand Down
12 changes: 6 additions & 6 deletions internal/service/badge/badge_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ func (b *BadgeService) ListByGroup(ctx context.Context, userID string) (resp []*
}

badgesMap[badge.BadgeGroupID] = append(badgesMap[badge.BadgeGroupID], &schema.BadgeListInfo{
ID: uid.EnShortID(badge.ID),
Name: translator.Tr(handler.GetLangByCtx(ctx), badge.Name),
Icon: badge.Icon,
AwardCount: badge.AwardCount,
Earned: earned,
Level: badge.Level,
ID: uid.EnShortID(badge.ID),
Name: translator.Tr(handler.GetLangByCtx(ctx), badge.Name),
Icon: badge.Icon,
AwardCount: badge.AwardCount,
EarnedCount: earned,
Level: badge.Level,
})
}

Expand Down

0 comments on commit 1666b94

Please sign in to comment.