Files
juwan-backend/app/dispute/rpc/internal/logic/getDisputesByIdLogic.go
T

34 lines
755 B
Go

package logic
import (
"context"
"juwan-backend/app/dispute/rpc/internal/svc"
"juwan-backend/app/dispute/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type GetDisputesByIdLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetDisputesByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDisputesByIdLogic {
return &GetDisputesByIdLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetDisputesByIdLogic) GetDisputesById(in *pb.GetDisputesByIdReq) (*pb.GetDisputesByIdResp, error) {
d, err := l.svcCtx.DisputeModelRO.Disputes.Get(l.ctx, in.GetId())
if err != nil {
return nil, err
}
return &pb.GetDisputesByIdResp{Disputes: entDisputeToPb(d)}, nil
}