2024-01-02 14:04:16 +00:00
|
|
|
package benefactorkindboxservice
|
2023-12-26 17:52:20 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2024-07-09 17:17:04 +00:00
|
|
|
params "git.gocasts.ir/ebhomengo/niki/param"
|
2023-12-26 17:53:25 +00:00
|
|
|
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box"
|
2023-12-26 17:52:20 +00:00
|
|
|
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
|
|
|
)
|
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
// TODO: Pagination, Filters, Sort.
|
|
|
|
func (s Service) GetAll(ctx context.Context, req param.KindBoxGetAllRequest) (param.KindBoxGetAllResponse, error) {
|
|
|
|
const op = "userkindboxservice.GetAll"
|
2023-12-26 17:52:20 +00:00
|
|
|
|
2024-07-09 17:17:04 +00:00
|
|
|
allKindBox, _, err := s.repo.GetAllKindBox(ctx, params.FilterRequest{}, params.PaginationRequest{}, params.SortRequest{})
|
2023-12-26 17:52:20 +00:00
|
|
|
if err != nil {
|
2023-12-26 17:53:25 +00:00
|
|
|
return param.KindBoxGetAllResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
|
2023-12-26 17:52:20 +00:00
|
|
|
}
|
|
|
|
|
2023-12-26 17:53:25 +00:00
|
|
|
return param.KindBoxGetAllResponse{AllKindBox: allKindBox}, nil
|
2023-12-26 17:52:20 +00:00
|
|
|
}
|