2023-12-25 17:08:19 +00:00
|
|
|
package userkindboxreqservice
|
2023-12-20 08:27:13 +00:00
|
|
|
|
2023-12-22 21:25:16 +00:00
|
|
|
import (
|
2023-12-22 21:42:57 +00:00
|
|
|
"context"
|
|
|
|
|
2023-12-25 17:08:19 +00:00
|
|
|
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req"
|
2023-12-22 21:25:16 +00:00
|
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
|
|
)
|
2023-12-20 08:27:13 +00:00
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
// TODO: Pagination, Filters, Sort.
|
2023-12-26 13:11:29 +00:00
|
|
|
func (s Service) GetAll(ctx context.Context, req param.KindBoxReqGetAllRequest) (param.KindBoxReqGetAllResponse, error) {
|
2023-12-25 17:08:19 +00:00
|
|
|
const op = "userkindboxreqservice.GetAll"
|
|
|
|
|
|
|
|
allKindBoxReq, err := s.repo.GetAllKindBoxReq(ctx, req.BenefactorID)
|
2023-12-22 21:25:16 +00:00
|
|
|
if err != nil {
|
|
|
|
return param.KindBoxReqGetAllResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
|
|
|
|
}
|
2023-12-26 13:11:29 +00:00
|
|
|
|
2023-12-22 21:25:16 +00:00
|
|
|
return param.KindBoxReqGetAllResponse{AllKindBoxReq: allKindBoxReq}, nil
|
2023-12-20 08:27:13 +00:00
|
|
|
}
|