forked from ebhomengo/niki
1
0
Fork 0
niki/service/admin/kind_box/add.go

25 lines
723 B
Go
Raw Normal View History

2023-12-25 17:08:19 +00:00
package adminkindboxservice
import (
"context"
entity "git.gocasts.ir/ebhomengo/niki/entity"
2023-12-25 17:08:19 +00:00
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) {
2023-12-25 17:08:19 +00:00
const op = "adminkindboxservice.Add"
kindBox, err := s.repo.AddKindBox(ctx, entity.KindBox{
BenefactorID: req.BenefactorID,
KindBoxReqID: req.KindBoxReqID,
Status: entity.KindBoxPendingSendStatus,
})
if err != nil {
return param.KindBoxAddResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
2024-01-01 07:22:14 +00:00
return param.KindBoxAddResponse{KindBox: kindBox}, nil
}