add: user accomplished
This commit is contained in:
@@ -2,6 +2,7 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"juwan-backend/app/users/rpc/internal/models/users"
|
||||
|
||||
"juwan-backend/app/users/rpc/internal/svc"
|
||||
"juwan-backend/app/users/rpc/pb"
|
||||
@@ -26,12 +27,16 @@ func NewGetUsersByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetU
|
||||
|
||||
func (l *GetUsersByIdLogic) GetUsersById(in *pb.GetUsersByIdReq) (*pb.GetUsersByIdResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
user, err := l.svcCtx.UsersModelRO.FindOne(l.ctx, in.Id)
|
||||
//user, err := l.svcCtx.UsersModelRO.FindOne(l.ctx, in.Id)
|
||||
user, err := l.svcCtx.UsersModelRO.Query().Where(users.IDEQ(in.Id)).All(l.ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pbUser := &pb.Users{}
|
||||
converter.StructToStruct(&user, &pbUser)
|
||||
err = converter.StructToStruct(&user, &pbUser)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.GetUsersByIdResp{Users: pbUser}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user