package adminkindboxreqservice import ( "context" param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) func (s Service) Reject(ctx context.Context, req param.KindBoxReqRejectRequest) (param.KindBoxReqRejectResponse, error) { const op = "adminkindboxreqservice.Reject" err := s.repo.RejectKindBoxReq(ctx, req.ID, req.Description) if err != nil { return param.KindBoxReqRejectResponse{}, richerror.New(op).WithErr(err) } // fire new event to create a kind-box. // get kind box req kindBoxReq, gErr := s.repo.GetByID(ctx, req.ID) if gErr != nil { return param.KindBoxReqRejectResponse{}, richerror.New(op).WithErr(err) } return param.KindBoxReqRejectResponse{ ID: kindBoxReq.ID, KindBoxType: kindBoxReq.KindBoxType, CountRequested: kindBoxReq.CountRequested, BenefactorID: kindBoxReq.BenefactorID, Status: kindBoxReq.Status, Description: kindBoxReq.Description, ReferDate: kindBoxReq.ReferDate, AddressID: kindBoxReq.AddressID, }, nil }