Skip to content

Commit

Permalink
feat(queries.GetProfile): use a new if block to add condition to get …
Browse files Browse the repository at this point in the history
…comment reward
  • Loading branch information
Tanngent2005 committed Apr 9, 2024
1 parent 8c10138 commit 6f1854c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/queries/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,8 @@ 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 {
if id == uid || user.IsAdmin || user.IsCommunityAdmin {
r.Reward = user.Reward
}
return r, nil
Expand Down

0 comments on commit 6f1854c

Please sign in to comment.