forked from ebhomengo/niki
25 lines
750 B
Go
25 lines
750 B
Go
package adminseederservice
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.gocasts.ir/ebhomengo/niki/entity"
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
)
|
|
|
|
func (s Service) AssignSenderToKindBoxReq(ctx context.Context, agentId uint) (entity.KindBoxReq, error) {
|
|
const op = "adminseederservice.AssignSenderToKindBoxReq"
|
|
|
|
kindBoxReq, kErr := s.AddKindBoxReq(ctx, entity.KindBoxReqAssignedSenderAgentStatus)
|
|
if kErr != nil {
|
|
return entity.KindBoxReq{}, richerror.New(op).WithErr(kErr).WithKind(richerror.KindUnexpected)
|
|
}
|
|
|
|
aErr := s.kindBoxReqRepo.AssignSenderAgentToKindBoxReq(ctx, kindBoxReq.ID, agentId)
|
|
if aErr != nil {
|
|
return entity.KindBoxReq{}, richerror.New(op).WithErr(aErr).WithKind(richerror.KindUnexpected)
|
|
}
|
|
|
|
return kindBoxReq, nil
|
|
}
|