Skip to content

Commit

Permalink
Renamed skip to offset
Browse files Browse the repository at this point in the history
  • Loading branch information
korridor committed Oct 1, 2024
1 parent 46ba4ac commit 22c1d44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V1/TimeEntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function index(Organization $organization, TimeEntryIndexRequest $request
$limit = 1000;
}
$timeEntriesQuery->limit($limit);
$timeEntriesQuery->skip($request->getSkip());
$timeEntriesQuery->skip($request->getOffset());

$timeEntries = $timeEntriesQuery->get();

Expand Down
6 changes: 3 additions & 3 deletions app/Http/Requests/V1/TimeEntry/TimeEntryIndexRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function rules(): array
'max:500',
],
// Skip the first n time entries (default: 0)
'skip' => [
'offset' => [
'integer',
'min:0',
],
Expand All @@ -154,8 +154,8 @@ public function getLimit(): int
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;
}
}
4 changes: 2 additions & 2 deletions tests/Unit/Endpoint/Api/V1/TimeEntryEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public function test_index_endpoint_with_all_available_filters(): void
);
}

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([
Expand All @@ -494,7 +494,7 @@ public function test_index_endpoint_with_limit_skip_and_only_full_dates_deactiva
'member_id' => $data->member->getKey(),
'project_ids' => [$project1->getKey()],
'limit' => 1,
'skip' => 1,
'offset' => 1,
'only_full_dates' => 'false',
]));

Expand Down

0 comments on commit 22c1d44

Please sign in to comment.