forked from ebhomengo/niki
24 lines
751 B
Go
24 lines
751 B
Go
package adminkindboxservice
|
|
|
|
import (
|
|
"context"
|
|
|
|
entity "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) Add(ctx context.Context, req param.KindBoxAddRequest) (param.KindBoxAddResponse, error) {
|
|
const op = "adminkindboxservice.Add"
|
|
kindBox, err := s.repo.AddKindBox(ctx, entity.KindBox{
|
|
KindBoxReqID: req.KindBoxReqID,
|
|
SenderID: req.SenderID,
|
|
SerialNumber: req.SerialNumber,
|
|
Status: entity.KindBoxPendingSendStatus,
|
|
})
|
|
if err != nil {
|
|
return param.KindBoxAddResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
|
|
}
|
|
return param.KindBoxAddResponse{KindBox: kindBox}, nil
|
|
}
|