forked from ebhomengo/niki
34 lines
931 B
Go
34 lines
931 B
Go
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) Update(ctx context.Context, req param.KindBoxReqUpdateRequest) error {
|
|
const op = "adminkindboxreqservice.Update"
|
|
|
|
kindBoxReq, err := s.repo.GetByID(ctx, req.ID)
|
|
if err != nil {
|
|
return richerror.New(op).WithErr(err)
|
|
}
|
|
|
|
kindBoxReq.KindBoxType = req.KindBoxType
|
|
kindBoxReq.CountRequested = req.CountRequested
|
|
kindBoxReq.CountAccepted = req.CountAccepted
|
|
kindBoxReq.Description = req.Description
|
|
kindBoxReq.DeliverReferTimeID = req.DeliverReferTimeID
|
|
kindBoxReq.DeliverReferDate = req.DeliverReferDate
|
|
kindBoxReq.DeliverAddressID = req.DeliverAddressID
|
|
kindBoxReq.SenderAgentID = req.SenderAgentID
|
|
|
|
uErr := s.repo.UpdateKindBoxReq(ctx, kindBoxReq)
|
|
if uErr != nil {
|
|
return richerror.New(op).WithErr(err)
|
|
}
|
|
|
|
return nil
|
|
}
|