Renamed skip to offset

This commit is contained in:
Constantin Graf
2024-10-01 15:38:24 +02:00
committed by Gregor Vostrak
parent d200de54a8
commit fcba96fbf6
3 changed files with 6 additions and 6 deletions

View File

@@ -85,7 +85,7 @@ class TimeEntryController extends Controller
$limit = 1000; $limit = 1000;
} }
$timeEntriesQuery->limit($limit); $timeEntriesQuery->limit($limit);
$timeEntriesQuery->skip($request->getSkip()); $timeEntriesQuery->skip($request->getOffset());
$timeEntries = $timeEntriesQuery->get(); $timeEntries = $timeEntriesQuery->get();

View File

@@ -132,7 +132,7 @@ class TimeEntryIndexRequest extends FormRequest
'max:500', 'max:500',
], ],
// Skip the first n time entries (default: 0) // Skip the first n time entries (default: 0)
'skip' => [ 'offset' => [
'integer', 'integer',
'min:0', 'min:0',
], ],
@@ -154,8 +154,8 @@ class TimeEntryIndexRequest extends FormRequest
return $this->has('limit') ? (int) $this->validated('limit', 100) : 100; 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;
} }
} }

View File

@@ -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 // Arrange
$data = $this->createUserWithPermission([ $data = $this->createUserWithPermission([
@@ -494,7 +494,7 @@ class TimeEntryEndpointTest extends ApiEndpointTestAbstract
'member_id' => $data->member->getKey(), 'member_id' => $data->member->getKey(),
'project_ids' => [$project1->getKey()], 'project_ids' => [$project1->getKey()],
'limit' => 1, 'limit' => 1,
'skip' => 1, 'offset' => 1,
'only_full_dates' => 'false', 'only_full_dates' => 'false',
])); ]));