add: some user api and all api desc
This commit is contained in:
@@ -6,9 +6,10 @@ package user
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/users/api/internal/contextx"
|
||||
"juwan-backend/app/users/rpc/usercenter"
|
||||
"juwan-backend/common/converter"
|
||||
"juwan-backend/common/utils/contextx"
|
||||
"strings"
|
||||
|
||||
"juwan-backend/app/users/api/internal/svc"
|
||||
"juwan-backend/app/users/api/internal/types"
|
||||
@@ -31,16 +32,16 @@ func NewUpdateMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateMe
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateMeLogic) UpdateMe(req *types.UpdateUserInfoReq) (resp *types.UserInfo, err error) {
|
||||
func (l *UpdateMeLogic) UpdateMe(req *types.UpdateUserProfileReq) (resp *types.UpdateUserProfileReq, err error) {
|
||||
userId, err := contextx.UserIDFrom(l.ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res, err := l.svcCtx.UserRpc.UpdateUsers(l.ctx, &usercenter.UpdateUsersReq{
|
||||
Id: userId,
|
||||
Nickname: req.Nickname,
|
||||
Avatar: req.Avatar,
|
||||
Bio: req.Bio,
|
||||
Nickname: proto_string(req.Nickname),
|
||||
Avatar: proto_string(req.Avatar),
|
||||
Bio: proto_string(req.Bio),
|
||||
VerifiedRoles: nil,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -53,3 +54,10 @@ func (l *UpdateMeLogic) UpdateMe(req *types.UpdateUserInfoReq) (resp *types.User
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func proto_string(s string) *string {
|
||||
if len(s) == 0 || strings.Contains(s, " ") {
|
||||
return nil
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user