add: user accomplished
This commit is contained in:
@@ -5,6 +5,9 @@ package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/users/api/internal/contextx"
|
||||
"juwan-backend/app/users/rpc/usercenter"
|
||||
|
||||
"juwan-backend/app/users/api/internal/svc"
|
||||
"juwan-backend/app/users/api/internal/types"
|
||||
@@ -28,7 +31,18 @@ func NewUpdateUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Up
|
||||
}
|
||||
|
||||
func (l *UpdateUserInfoLogic) UpdateUserInfo(req *types.UpdateUserInfoReq) (resp *types.UpdateUserInfoResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
userId, err := contextx.UserIDFrom(l.ctx)
|
||||
if err != nil {
|
||||
return nil, errors.New("user not found")
|
||||
}
|
||||
_, err = l.svcCtx.UserRpc.UpdateUsers(l.ctx, &usercenter.UpdateUsersReq{
|
||||
Id: userId,
|
||||
Nickname: req.Nickname,
|
||||
Avatar: req.Avatar,
|
||||
Bio: req.Bio,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.New("update user info failed")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user