niki/service/admin/kind_box_req/assign_sender_agent.go

20 lines
616 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) AssignSenderAgent(ctx context.Context, req param.AssignSenderRequest) (param.AssignSenderResponse, error) {
const op = "adminkindboxreqservice.AssignSenderAgent"
err := s.repo.AssignSenderAgentToKindBoxReq(ctx, req.KindBoxReqID, req.SenderAgentID)
if err != nil {
return param.AssignSenderResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
return param.AssignSenderResponse{}, nil
}