From fcba96fbf62f07468affd999102f4fb05abb3ca3 Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Tue, 1 Oct 2024 15:38:24 +0200 Subject: [PATCH] Renamed skip to offset --- app/Http/Controllers/Api/V1/TimeEntryController.php | 2 +- app/Http/Requests/V1/TimeEntry/TimeEntryIndexRequest.php | 6 +++--- tests/Unit/Endpoint/Api/V1/TimeEntryEndpointTest.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Api/V1/TimeEntryController.php b/app/Http/Controllers/Api/V1/TimeEntryController.php index 475e6047..4487d942 100644 --- a/app/Http/Controllers/Api/V1/TimeEntryController.php +++ b/app/Http/Controllers/Api/V1/TimeEntryController.php @@ -85,7 +85,7 @@ class TimeEntryController extends Controller $limit = 1000; } $timeEntriesQuery->limit($limit); - $timeEntriesQuery->skip($request->getSkip()); + $timeEntriesQuery->skip($request->getOffset()); $timeEntries = $timeEntriesQuery->get(); diff --git a/app/Http/Requests/V1/TimeEntry/TimeEntryIndexRequest.php b/app/Http/Requests/V1/TimeEntry/TimeEntryIndexRequest.php index 22e7a954..f877eb3f 100644 --- a/app/Http/Requests/V1/TimeEntry/TimeEntryIndexRequest.php +++ b/app/Http/Requests/V1/TimeEntry/TimeEntryIndexRequest.php @@ -132,7 +132,7 @@ class TimeEntryIndexRequest extends FormRequest 'max:500', ], // Skip the first n time entries (default: 0) - 'skip' => [ + 'offset' => [ 'integer', 'min:0', ], @@ -154,8 +154,8 @@ class TimeEntryIndexRequest extends FormRequest return $this->has('limit') ? (int) $this->validated('limit', 100) : 100; } - public function getSkip(): int + public function getOffset(): int { - return $this->has('skip') ? (int) $this->validated('skip', 0) : 0; + return $this->has('offset') ? (int) $this->validated('offset', 0) : 0; } } diff --git a/tests/Unit/Endpoint/Api/V1/TimeEntryEndpointTest.php b/tests/Unit/Endpoint/Api/V1/TimeEntryEndpointTest.php index 628a6abf..bb745a87 100644 --- a/tests/Unit/Endpoint/Api/V1/TimeEntryEndpointTest.php +++ b/tests/Unit/Endpoint/Api/V1/TimeEntryEndpointTest.php @@ -468,7 +468,7 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract ); } - public function test_index_endpoint_with_limit_skip_and_only_full_dates_deactivated(): void + public function test_index_endpoint_with_limit_offset_and_only_full_dates_deactivated(): void { // Arrange $data = $this->createUserWithPermission([ @@ -494,7 +494,7 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract 'member_id' => $data->member->getKey(), 'project_ids' => [$project1->getKey()], 'limit' => 1, - 'skip' => 1, + 'offset' => 1, 'only_full_dates' => 'false', ]));