forked from ebhomengo/niki
32 lines
874 B
Go
32 lines
874 B
Go
package benefactorkindboxreqservice
|
|
|
|
import (
|
|
"context"
|
|
|
|
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/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 = "benefactorkindboxreqservice.Update"
|
|
|
|
kindBoxReq, err := s.repo.GetKindBoxReqByID(ctx, req.KindBoxReqID)
|
|
if err != nil {
|
|
return richerror.New(op).WithErr(err)
|
|
}
|
|
|
|
kindBoxReq.KindBoxType = req.KindBoxType
|
|
kindBoxReq.CountRequested = req.CountRequested
|
|
kindBoxReq.Description = req.Description
|
|
kindBoxReq.DeliverReferTimeID = req.DeliverReferTimeID
|
|
kindBoxReq.DeliverReferDate = req.DeliverReferDate
|
|
kindBoxReq.DeliverAddressID = req.DeliverAddressID
|
|
|
|
uErr := s.repo.UpdateKindBoxReq(ctx, kindBoxReq)
|
|
if uErr != nil {
|
|
return richerror.New(op).WithErr(err)
|
|
}
|
|
|
|
return nil
|
|
}
|