fix: unify user ID type to string and rename service to users-api
This commit is contained in:
@@ -6,6 +6,8 @@ package user
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
"juwan-backend/app/users/rpc/usercenter"
|
||||
"juwan-backend/common/utils/contextj"
|
||||
|
||||
@@ -31,14 +33,18 @@ func NewUnfollowUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Unfo
|
||||
}
|
||||
|
||||
func (l *UnfollowUserLogic) UnfollowUser(req *types.UnfollowUserReq) (resp *types.EmptyResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
userId, err := contextj.UserIDFrom(l.ctx)
|
||||
if err != nil {
|
||||
return nil, errors.New("unauthorized")
|
||||
}
|
||||
|
||||
targetId, err := strconv.ParseInt(req.Id, 10, 64)
|
||||
if err != nil {
|
||||
return nil, errors.New("invalid user id")
|
||||
}
|
||||
|
||||
_, err = l.svcCtx.UserRpc.DelUserFollows(l.ctx, &usercenter.DelUserFollowsReq{
|
||||
Id: req.Id,
|
||||
Id: targetId,
|
||||
UserId: userId,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user