MCPcopy
hub / github.com/apache/answer / GetUserBasicInfoByID

Method GetUserBasicInfoByID

internal/service/user_common/user.go:88–97  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

86}
87
88func (us *UserCommon) GetUserBasicInfoByID(ctx context.Context, id string) (
89 userBasicInfo *schema.UserBasicInfo, exist bool, err error) {
90 userInfo, exist, err := us.userRepo.GetByUserID(ctx, id)
91 if err != nil {
92 return nil, exist, err
93 }
94 info := us.FormatUserBasicInfo(ctx, userInfo)
95 info.Avatar = us.siteInfoCommonService.FormatAvatar(ctx, userInfo.Avatar, userInfo.EMail, userInfo.Status).GetURL()
96 return info, exist, nil
97}
98
99func (us *UserCommon) GetUserBasicInfoByUserName(ctx context.Context, username string) (*schema.UserBasicInfo, bool, error) {
100 userInfo, exist, err := us.userRepo.GetByUsername(ctx, username)

Callers 15

getUserInfoMethod · 0.80
CheckVotePermissionMethod · 0.80
AddNotificationMethod · 0.80
AddCommentMethod · 0.80
GetCommentMethod · 0.80

Calls 4

FormatUserBasicInfoMethod · 0.95
GetURLMethod · 0.80
GetByUserIDMethod · 0.65
FormatAvatarMethod · 0.65

Tested by

no test coverage detected