Skip to content

Commit

Permalink
feat(queries.getprofile): add condition to get comment reward
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanngent2005 committed Apr 9, 2024
1 parent 88ce7f3 commit 8c10138
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/queries/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ func GetProfile(db *gorm.DB, id uint, uid uint) (models.ProfileResponse, error)
r := models.ProfileResponse{ID: id, Email: user.Email, Year: user.Year, Grade: user.Grade, NickName: user.NickName, RealName: user.RealName, IsAnonymous: user.IsAnonymous, Avatar: avatar, IsAdmin: user.IsAdmin, IsCommunityAdmin: user.IsCommunityAdmin, Reward: user.Reward}
if id == uid {
r.InvitationCode = user.InvitationCode
r.Reward = user.Reward
}
if user.IsAdmin || user.IsCommunityAdmin {
r.Reward = user.Reward
}
return r, nil
}
Expand Down

0 comments on commit 8c10138

Please sign in to comment.