forked from ebhomengo/niki
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package adminkindboxreqservice
|
|
|
|
import (
|
|
"context"
|
|
|
|
paginationparam "git.gocasts.ir/ebhomengo/niki/param"
|
|
param "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
)
|
|
|
|
func (s Service) GetAllAwaitingDelivery(ctx context.Context, req param.DeliveryAwaitingGetAllRequest) (param.DeliveryAwaitingGetAllResponse, error) {
|
|
const op = "adminkindboxreqservice.GetAllAwaitingDelivery"
|
|
|
|
if fieldErrors, vErr := s.vld.ValidateGetAllAwaitingDelivery(req); vErr != nil {
|
|
return param.DeliveryAwaitingGetAllResponse{FieldErrors: fieldErrors}, richerror.New(op).WithErr(vErr)
|
|
}
|
|
|
|
allAwaitingKindBoxReq, total, err := s.repo.GetAllKindBoxReq(ctx, req.Filter, req.Pagination, req.Sort)
|
|
if err != nil {
|
|
return param.DeliveryAwaitingGetAllResponse{}, richerror.New(op).WithErr(err)
|
|
}
|
|
|
|
return param.DeliveryAwaitingGetAllResponse{
|
|
AllAwaitingKindBoxReq: allAwaitingKindBoxReq,
|
|
Pagination: paginationparam.PaginationResponse{
|
|
PageSize: req.Pagination.GetPageSize(),
|
|
PageNumber: req.Pagination.GetPageNumber(),
|
|
Total: total,
|
|
},
|
|
}, nil
|
|
}
|