2023-12-25 17:08:19 +00:00
|
|
|
package adminkindboxreqservice
|
2024-02-03 04:56:27 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2024-06-11 18:46:51 +00:00
|
|
|
orderparam "git.gocasts.ir/ebhomengo/niki/param"
|
|
|
|
|
2024-04-28 11:27:23 +00:00
|
|
|
paginationparam "git.gocasts.ir/ebhomengo/niki/param"
|
2024-02-03 04:56:27 +00:00
|
|
|
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
|
|
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TODO: Pagination, Filters, Sort.
|
2024-06-11 18:46:51 +00:00
|
|
|
func (s Service) GetAll(ctx context.Context, _ param.KindBoxReqGetAllRequest, paginationreq paginationparam.PaginationRequest, orderreq orderparam.OrderRequest) (param.KindBoxReqGetAllResponse, error) {
|
2024-02-03 04:56:27 +00:00
|
|
|
const op = "adminkindboxreqservice.GetAll"
|
|
|
|
|
2024-06-11 18:46:51 +00:00
|
|
|
allKindBoxReq, pagination, err := s.repo.GetAllKindBoxReq(ctx, paginationreq, orderreq)
|
2024-02-03 04:56:27 +00:00
|
|
|
if err != nil {
|
|
|
|
return param.KindBoxReqGetAllResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
|
|
|
|
}
|
|
|
|
|
2024-04-28 11:27:23 +00:00
|
|
|
return param.KindBoxReqGetAllResponse{
|
|
|
|
AllKindBoxReq: allKindBoxReq,
|
|
|
|
Pagination: paginationparam.PaginationResponse{
|
|
|
|
PageSize: pagination.PageSize,
|
|
|
|
PageNumber: pagination.PageNumber,
|
|
|
|
Total: pagination.Total,
|
|
|
|
},
|
|
|
|
}, nil
|
2024-02-03 04:56:27 +00:00
|
|
|
}
|