package benefactorkindboxservice import ( "context" params "git.gocasts.ir/ebhomengo/niki/param" param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) func (s Service) GetAll(ctx context.Context, req param.KindBoxGetAllRequest) (param.KindBoxGetAllResponse, error) { const op = "benefactorkindboxservice.GetAll" if fieldErrors, vErr := s.vld.ValidateGetAll(req); vErr != nil { return param.KindBoxGetAllResponse{FieldErrors: fieldErrors}, richerror.New(op).WithErr(vErr) } allKindBox, total, err := s.repo.GetAllKindBox(ctx, req.Filter, req.Pagination, req.Sort) if err != nil { return param.KindBoxGetAllResponse{}, richerror.New(op).WithErr(err) } return param.KindBoxGetAllResponse{ AllKindBox: allKindBox, Pagination: params.PaginationResponse{ PageSize: req.Pagination.GetPageSize(), PageNumber: req.Pagination.GetPageNumber(), Total: total, }, }, nil }