package adminkindboxservice import ( "context" "git.gocasts.ir/ebhomengo/niki/entity" param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) func (s Service) AssignReceiverAgent(ctx context.Context, req param.AssignReceiverRequest) (param.AssignReceiverResponse, error) { const op = "AdminKindBoxService.AssignReceiverAgent" if fieldErrors, vErr := s.vld.ValidateAssignReceiverAgent(ctx, req); vErr != nil { return param.AssignReceiverResponse{FieldErrors: fieldErrors}, richerror.New(op).WithErr(vErr) } aErr := s.repo.AssignReceiverAgent(ctx, entity.KindBox{ ID: req.KindBoxID, ReceiverAgentID: req.ReceiverAgentID, }) if aErr != nil { return param.AssignReceiverResponse{}, richerror.New(op).WithErr(aErr) } return param.AssignReceiverResponse{}, nil }