fix: a bunch of dumb stupid crap

This commit is contained in:
b1ek 2024-08-30 17:29:18 +10:00
parent af9762945b
commit b363bf9fc2
Signed by: blek
GPG Key ID: 14546221E3595D0C
3 changed files with 14 additions and 11 deletions

View File

@ -6,5 +6,5 @@ class Filter
{
public FilterTypeEnum $type;
public string $column;
public string $filter;
public mixed $filter;
}

View File

@ -9,17 +9,20 @@ use JsonMapper;
class Filters
{
public const FILTERS_VALIDATION = [];
// 'filters.*.column' => [ 'required', 'string' ],
// 'filters.*.type' => [ 'required', Rule::enum(FilterTypeEnum::class) ],
// 'filters.*.filter' => [ 'required', 'string' ],
public static function rules()
{
return [
'filters.*.column' => [ '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) ],
'orders.*.by' => [ 'required', 'string' ],
'orders.*.sort' => [ 'required', Rule::enum(OrderTypeEnum::class) ],
// 'pagination.size' => 'number',
// 'pagination.page' => 'number',
// ];
'pagination.size' => 'number',
'pagination.page' => 'number',
];
}
/**
* @var Filter[]

View File

@ -7,6 +7,6 @@ class AuthorizedFilterListRequest extends AuthorizedRequest
{
public function rules()
{
return Filters::FILTERS_VALIDATION;
return Filters::rules();
}
}