Skip to content

Commit

Permalink
♻️ Adapt operator(s) endpoint to adhere to zalando convention (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin committed Jun 1, 2024
1 parent a5cbe31 commit 41ce6b0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions API_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ In this we try to keep track of changes to the API.
Primarily this should document changes that are not backwards compatible or belongs to already documented endpoints.
This is to help you keep track of the changes and to help you update your code accordingly.

## 2024-06-01

Changed `/operator` to `/operators`

## 2024-05-31

The `StatusResource` is now returning the whole `UserResource` for the user who created it in the `userDetails` field.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/v1/OperatorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class OperatorController extends Controller
{
/**
* @OA\Get(
* path="/operator",
* path="/operators",
* summary="Get a list of all operators.",
* tags={"Checkin"},
* @OA\Response(
Expand Down
2 changes: 1 addition & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
Route::put('station/{oldStationId}/merge/{newStationId}', [StationController::class, 'merge']); // currently admin/backend only

Route::apiResource('report', ReportController::class);
Route::apiResource('operator', OperatorController::class)->only(['index']);
Route::apiResource('operators', OperatorController::class)->only(['index']);
});

Route::group(['middleware' => ['privacy-policy']], static function() {
Expand Down
4 changes: 2 additions & 2 deletions storage/api-docs/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1247,13 +1247,13 @@
]
}
},
"/operator": {
"/operators": {
"get": {
"tags": [
"Checkin"
],
"summary": "Get a list of all operators.",
"operationId": "5e836fb23709a92be4c939e036765dbb",
"operationId": "bcfcf8686980cf0fcdc751b2e13fa4f7",
"responses": {
"200": {
"description": "successful operation",
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/APIv1/OperatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class OperatorTest extends ApiTestCase

use RefreshDatabase;

public function testOperatorIndex(): void {
public function testOperatorsIndex(): void {
Passport::actingAs(User::factory()->create(), ['*']);

HafasOperator::factory()->count(3)->create();

$response = $this->get('/api/v1/operator');
$response = $this->get('/api/v1/operators');
$response->assertOk();
$response->assertJsonCount(3, 'data');
$response->assertJsonStructure([
Expand Down

0 comments on commit 41ce6b0

Please sign in to comment.