Added filters to time-entries.index endpoint

This commit is contained in:
Constantin Graf
2024-02-27 12:05:18 +01:00
parent 9c5a238dda
commit 8b85f50e22
11 changed files with 538 additions and 349 deletions

View File

@@ -24,6 +24,7 @@ class TimeEntryIndexRequest extends FormRequest
public function rules(): array
{
return [
// Filter by user ID
'user_id' => [
'string',
'uuid',
@@ -35,16 +36,32 @@ class TimeEntryIndexRequest extends FormRequest
});
}),
],
// Filter only time entries that have a start date before (not including) the given date (example: 2021-12-31)
'before' => [
'nullable',
'string',
'date_format:Y-m-d',
'date_format:Y-m-d\TH:i:s\Z',
'before:after',
],
// Filter only time entries that have a start date after (not including) the given date (example: 2021-12-31)
'after' => [
'nullable',
'string',
'date_format:Y-m-d',
'date_format:Y-m-d\TH:i:s\Z',
],
// Filter only time entries that are active (have no end date, are still running)
'active' => [
'boolean',
],
// Limit the number of returned time entries
'limit' => [
'integer',
'min:1',
'max:500',
],
// Filter makes sure that only time entries of a whole date are returned
'only_full_dates' => [
'boolean',
],
];
}