diff --git a/app/Facade/Filters/Filters.php b/app/Facade/Filters/Filters.php index 4810dbb..af03239 100644 --- a/app/Facade/Filters/Filters.php +++ b/app/Facade/Filters/Filters.php @@ -1,29 +1,17 @@ [ 'required', 'string' ], - 'filters.*.type' => [ 'required', Rule::enum(FilterTypeEnum::class) ], - 'filters.*.filter' => [ 'required', 'nullable', 'string' ], - - 'orders.*.by' => [ 'required', 'string' ], - 'orders.*.sort' => [ 'required', Rule::enum(OrderTypeEnum::class) ], - - 'pagination.size' => 'number', - 'pagination.page' => 'number', - ]; - } - /** * @var Filter[] */ @@ -47,7 +35,11 @@ class Filters $data->orders ??= []; $data->pagination ??= null; - return $mapper->map($data, \App\Facade\Filters\Filters::class); + try { + return $mapper->map($data, \App\Facade\Filters\Filters::class); + } catch (Error $err) { + throw new HttpResponseException(response()->json([ 'unknown' => $err->getMessage() ], 422)); + } } public function apply(Builder $builder) diff --git a/app/Http/Requests/AuthorizedFilterListRequest.php b/app/Http/Requests/AuthorizedFilterListRequest.php deleted file mode 100644 index 6542749..0000000 --- a/app/Http/Requests/AuthorizedFilterListRequest.php +++ /dev/null @@ -1,12 +0,0 @@ -