forked from ebhomengo/niki
1
0
Fork 0
niki/service/admin/kind_box_req/get_all_delivery_awaiting.go

28 lines
923 B
Go
Raw Normal View History

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"
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
}