mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 08:12:17 +01:00
Added filters to time-entries.index endpoint
This commit is contained in:
@@ -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',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user