Skip to content

Commit 903c6c6

Browse files
committed
fix: incorrect routes in path parameter and incorrect files names and refs
1 parent 1857aba commit 903c6c6

File tree

6 files changed

+47
-68
lines changed

6 files changed

+47
-68
lines changed

app/Http/Controllers/Apis/Protected/Main/OAuth2ElectionsApiController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ public function __construct
9393
in: "query",
9494
required: false,
9595
schema: new OA\Schema(type: "string"),
96-
description: "Expand relationships"
96+
description: "Expand relationships: "
9797
),
9898
],
9999
responses: [
100100
new OA\Response(
101101
response: Response::HTTP_OK,
102102
description: "Elections list retrieved successfully",
103-
content: new OA\JsonContent(ref: "#/components/schemas/ElectionsList")
103+
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedElectionsResponse")
104104
),
105105
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
106106
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
@@ -152,7 +152,7 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) {
152152
}
153153

154154
#[OA\Get(
155-
path: "/api/v1/elections/current",
155+
path: "/api/public/v1/elections/current",
156156
operationId: "getCurrentElection",
157157
description: "Get the current active election",
158158
tags: ["Elections (Public)"],
@@ -252,7 +252,7 @@ public function getById($election_id)
252252
}
253253

254254
#[OA\Get(
255-
path: "/api/v1/elections/current/candidates",
255+
path: "/api/public/v1/elections/current/candidates",
256256
operationId: "getCurrentElectionCandidates",
257257
description: "Get all accepted candidates for the current election. Supports expand parameter to include member and/or election objects",
258258
tags: ["Elections (Public)"],
@@ -297,7 +297,7 @@ public function getById($election_id)
297297
new OA\Response(
298298
response: Response::HTTP_OK,
299299
description: "Current election candidates retrieved successfully",
300-
content: new OA\JsonContent(ref: "#/components/schemas/CandidatesList")
300+
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedCandidatesResponse")
301301
),
302302
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "No current election found"),
303303
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
@@ -405,7 +405,7 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($election)
405405
new OA\Response(
406406
response: Response::HTTP_OK,
407407
description: "Election candidates retrieved successfully",
408-
content: new OA\JsonContent(ref: "#/components/schemas/CandidatesList")
408+
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedCandidatesResponse")
409409
),
410410
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Election not found"),
411411
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
@@ -460,7 +460,7 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($election)
460460
}
461461

462462
#[OA\Get(
463-
path: "/api/v1/elections/current/candidates/gold",
463+
path: "/api/public/v1/elections/current/candidates/gold",
464464
operationId: "getCurrentGoldCandidates",
465465
description: "Get all gold (featured) candidates for the current election. Supports expand parameter to include member and/or election objects",
466466
tags: ["Elections (Public)"],
@@ -505,7 +505,7 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($election)
505505
new OA\Response(
506506
response: Response::HTTP_OK,
507507
description: "Gold candidates retrieved successfully",
508-
content: new OA\JsonContent(ref: "#/components/schemas/CandidatesList")
508+
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedCandidatesResponse")
509509
),
510510
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "No current election found"),
511511
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
@@ -613,7 +613,7 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($election)
613613
new OA\Response(
614614
response: Response::HTTP_OK,
615615
description: "Gold candidates retrieved successfully",
616-
content: new OA\JsonContent(ref: "#/components/schemas/CandidatesList")
616+
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedCandidatesResponse")
617617
),
618618
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Election not found"),
619619
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
@@ -791,4 +791,4 @@ public function nominateCandidate(int $candidate_id)
791791

792792
});
793793
}
794-
}
794+
}

app/Swagger/CandidatesListSchema.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

app/Swagger/ElectionSchemas.php

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,40 @@ class NominationRequestSchema {}
3030

3131

3232
#[OA\Schema(
33-
schema: "ElectionsList",
34-
type: "object",
35-
properties: [
36-
new OA\Property(
37-
property: "data",
38-
type: "array",
39-
items: new OA\Items(ref: "#/components/schemas/Election")
40-
),
41-
new OA\Property(
42-
property: "total",
43-
type: "integer",
44-
example: 10
45-
),
46-
new OA\Property(
47-
property: "per_page",
48-
type: "integer",
49-
example: 20
50-
),
51-
new OA\Property(
52-
property: "current_page",
53-
type: "integer",
54-
example: 1
55-
),
56-
]
33+
schema: "PaginatedElectionsResponse",
34+
allOf: [
35+
new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'),
36+
new OA\Schema(
37+
type: 'object',
38+
properties: [
39+
new OA\Property(
40+
property: "data",
41+
type: "array",
42+
items: new OA\Items(ref: "#/components/schemas/Election")
43+
)
44+
]
45+
)]
46+
)]
47+
class PaginatedElectionsResponseSchema
48+
{
49+
}
50+
51+
52+
#[OA\Schema(
53+
schema: "PaginatedCandidatesResponse",
54+
allOf: [
55+
new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'),
56+
new OA\Schema(
57+
type: 'object',
58+
properties: [
59+
new OA\Property(
60+
property: "data",
61+
type: "array",
62+
items: new OA\Items(ref: "#/components/schemas/Candidate")
63+
)
64+
]
65+
)]
5766
)]
58-
class ElectionsListSchema {}
67+
class PaginatedCandidatesResponseSchema
68+
{
69+
}

app/Swagger/Security/ElectionOAuth2SecuritySchema.php renamed to app/Swagger/Security/ElectionOAuth2Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
],
2424
)
2525
]
26-
class ElectionOAuth2SecuritySchema {}
26+
class ElectionOAuth2Schema {}

0 commit comments

Comments
 (0)