Skip to content

Commit d3e4f3d

Browse files
feat: Extend Swagger Coverage for controller Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php
- fix: Typo seet_type should be seat_type in RSVPAdminAddRequest schema
1 parent a256c35 commit d3e4f3d

2 files changed

Lines changed: 314 additions & 2 deletions

File tree

app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php

Lines changed: 313 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* limitations under the License.
1313
**/
1414
use App\Models\Foundation\Summit\Repositories\ISummitBadgeFeatureTypeRepository;
15+
use App\Security\SummitScopes;
1516
use App\Services\Model\ISummitBadgeFeatureTypeService;
1617
use Illuminate\Http\Request as LaravelRequest;
1718
use Illuminate\Support\Facades\Log;
@@ -23,6 +24,7 @@
2324
use models\utils\IBaseRepository;
2425
use models\utils\IEntity;
2526
use ModelSerializers\SerializerRegistry;
27+
use OpenApi\Attributes as OA;
2628
use Exception;
2729
/**
2830
* Class OAuth2SummitBadgeFeatureTypeApiController
@@ -63,6 +65,316 @@ public function __construct
6365
$this->service = $service;
6466
}
6567

68+
// OpenAPI Documentation
69+
70+
#[OA\Get(
71+
path: '/api/v1/summits/{id}/badge-feature-types',
72+
summary: 'Get all badge feature types for a summit',
73+
description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).',
74+
security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]],
75+
tags: ['Badge Feature Types'],
76+
parameters: [
77+
new OA\Parameter(
78+
name: 'id',
79+
in: 'path',
80+
required: true,
81+
description: 'Summit ID',
82+
schema: new OA\Schema(type: 'integer')
83+
),
84+
new OA\Parameter(
85+
name: 'page',
86+
in: 'query',
87+
required: false,
88+
description: 'Page number for pagination',
89+
schema: new OA\Schema(type: 'integer', example: 1)
90+
),
91+
new OA\Parameter(
92+
name: 'per_page',
93+
in: 'query',
94+
required: false,
95+
description: 'Items per page',
96+
schema: new OA\Schema(type: 'integer', example: 10, maximum: 100)
97+
),
98+
new OA\Parameter(
99+
name: 'filter[]',
100+
in: 'query',
101+
required: false,
102+
description: 'Filter expressions. Format: field<op>value. Available field: name (=@, ==). Operators: == (equals), =@ (starts with)',
103+
style: 'form',
104+
explode: true,
105+
schema: new OA\Schema(
106+
type: 'array',
107+
items: new OA\Items(type: 'string', example: 'name@@speaker')
108+
)
109+
),
110+
new OA\Parameter(
111+
name: 'order',
112+
in: 'query',
113+
required: false,
114+
description: 'Order by field(s). Available fields: name, id. Use "-" prefix for descending order.',
115+
schema: new OA\Schema(type: 'string', example: 'name')
116+
),
117+
],
118+
responses: [
119+
new OA\Response(
120+
response: 200,
121+
description: 'Badge feature types retrieved successfully',
122+
content: new OA\JsonContent(ref: '#/components/schemas/PaginatedSummitBadgeFeatureTypesResponse')
123+
),
124+
new OA\Response(response: 400, ref: '#/components/responses/400'),
125+
new OA\Response(response: 401, ref: '#/components/responses/401'),
126+
new OA\Response(response: 403, ref: '#/components/responses/403'),
127+
new OA\Response(response: 404, ref: '#/components/responses/404'),
128+
new OA\Response(response: 412, ref: '#/components/responses/412'),
129+
new OA\Response(response: 500, ref: '#/components/responses/500'),
130+
]
131+
)]
132+
133+
#[OA\Get(
134+
path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}',
135+
summary: 'Get a badge feature type by ID',
136+
description: 'Retrieves detailed information about a specific badge feature type.',
137+
security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]],
138+
tags: ['Badge Feature Types'],
139+
parameters: [
140+
new OA\Parameter(
141+
name: 'id',
142+
in: 'path',
143+
required: true,
144+
description: 'Summit ID',
145+
schema: new OA\Schema(type: 'integer')
146+
),
147+
new OA\Parameter(
148+
name: 'feature_id',
149+
in: 'path',
150+
required: true,
151+
description: 'Badge Feature Type ID',
152+
schema: new OA\Schema(type: 'integer')
153+
),
154+
],
155+
responses: [
156+
new OA\Response(
157+
response: 200,
158+
description: 'Badge feature type retrieved successfully',
159+
content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType')
160+
),
161+
new OA\Response(response: 400, ref: '#/components/responses/400'),
162+
new OA\Response(response: 401, ref: '#/components/responses/401'),
163+
new OA\Response(response: 403, ref: '#/components/responses/403'),
164+
new OA\Response(response: 404, ref: '#/components/responses/404'),
165+
new OA\Response(response: 412, ref: '#/components/responses/412'),
166+
new OA\Response(response: 500, ref: '#/components/responses/500'),
167+
]
168+
)]
169+
170+
#[OA\Post(
171+
path: '/api/v1/summits/{id}/badge-feature-types',
172+
summary: 'Create a new badge feature type',
173+
description: 'Creates a new badge feature type for the summit.',
174+
security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]],
175+
tags: ['Badge Feature Types'],
176+
parameters: [
177+
new OA\Parameter(
178+
name: 'id',
179+
in: 'path',
180+
required: true,
181+
description: 'Summit ID',
182+
schema: new OA\Schema(type: 'integer')
183+
),
184+
],
185+
requestBody: new OA\RequestBody(
186+
required: true,
187+
content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureTypeCreateRequest')
188+
),
189+
responses: [
190+
new OA\Response(
191+
response: 201,
192+
description: 'Badge feature type created successfully',
193+
content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType')
194+
),
195+
new OA\Response(response: 400, ref: '#/components/responses/400'),
196+
new OA\Response(response: 401, ref: '#/components/responses/401'),
197+
new OA\Response(response: 403, ref: '#/components/responses/403'),
198+
new OA\Response(response: 404, ref: '#/components/responses/404'),
199+
new OA\Response(response: 412, ref: '#/components/responses/412'),
200+
new OA\Response(response: 422, ref: '#/components/responses/422'),
201+
new OA\Response(response: 500, ref: '#/components/responses/500'),
202+
]
203+
)]
204+
205+
#[OA\Put(
206+
path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}',
207+
summary: 'Update a badge feature type',
208+
description: 'Updates an existing badge feature type.',
209+
security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]],
210+
tags: ['Badge Feature Types'],
211+
parameters: [
212+
new OA\Parameter(
213+
name: 'id',
214+
in: 'path',
215+
required: true,
216+
description: 'Summit ID',
217+
schema: new OA\Schema(type: 'integer')
218+
),
219+
new OA\Parameter(
220+
name: 'feature_id',
221+
in: 'path',
222+
required: true,
223+
description: 'Badge Feature Type ID',
224+
schema: new OA\Schema(type: 'integer')
225+
),
226+
],
227+
requestBody: new OA\RequestBody(
228+
required: true,
229+
content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureTypeUpdateRequest')
230+
),
231+
responses: [
232+
new OA\Response(
233+
response: 200,
234+
description: 'Badge feature type updated successfully',
235+
content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType')
236+
),
237+
new OA\Response(response: 400, ref: '#/components/responses/400'),
238+
new OA\Response(response: 401, ref: '#/components/responses/401'),
239+
new OA\Response(response: 403, ref: '#/components/responses/403'),
240+
new OA\Response(response: 404, ref: '#/components/responses/404'),
241+
new OA\Response(response: 412, ref: '#/components/responses/412'),
242+
new OA\Response(response: 422, ref: '#/components/responses/422'),
243+
new OA\Response(response: 500, ref: '#/components/responses/500'),
244+
]
245+
)]
246+
247+
#[OA\Delete(
248+
path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}',
249+
summary: 'Delete a badge feature type',
250+
description: 'Deletes an existing badge feature type from the summit.',
251+
security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]],
252+
tags: ['Badge Feature Types'],
253+
parameters: [
254+
new OA\Parameter(
255+
name: 'id',
256+
in: 'path',
257+
required: true,
258+
description: 'Summit ID',
259+
schema: new OA\Schema(type: 'integer')
260+
),
261+
new OA\Parameter(
262+
name: 'feature_id',
263+
in: 'path',
264+
required: true,
265+
description: 'Badge Feature Type ID',
266+
schema: new OA\Schema(type: 'integer')
267+
),
268+
],
269+
responses: [
270+
new OA\Response(
271+
response: 204,
272+
description: 'Badge feature type deleted successfully'
273+
),
274+
new OA\Response(response: 400, ref: '#/components/responses/400'),
275+
new OA\Response(response: 401, ref: '#/components/responses/401'),
276+
new OA\Response(response: 403, ref: '#/components/responses/403'),
277+
new OA\Response(response: 404, ref: '#/components/responses/404'),
278+
new OA\Response(response: 412, ref: '#/components/responses/412'),
279+
new OA\Response(response: 500, ref: '#/components/responses/500'),
280+
]
281+
)]
282+
283+
#[OA\Post(
284+
path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image',
285+
summary: 'Add an image to a badge feature type',
286+
description: 'Uploads and associates an image file with a badge feature type. This image is typically displayed on attendee badges.',
287+
security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]],
288+
tags: ['Badge Feature Types'],
289+
parameters: [
290+
new OA\Parameter(
291+
name: 'id',
292+
in: 'path',
293+
required: true,
294+
description: 'Summit ID',
295+
schema: new OA\Schema(type: 'integer')
296+
),
297+
new OA\Parameter(
298+
name: 'feature_id',
299+
in: 'path',
300+
required: true,
301+
description: 'Badge Feature Type ID',
302+
schema: new OA\Schema(type: 'integer')
303+
),
304+
],
305+
requestBody: new OA\RequestBody(
306+
required: true,
307+
content: new OA\MediaType(
308+
mediaType: 'multipart/form-data',
309+
schema: new OA\Schema(
310+
required: ['file'],
311+
properties: [
312+
new OA\Property(
313+
property: 'file',
314+
type: 'string',
315+
format: 'binary',
316+
description: 'Image file to upload'
317+
)
318+
]
319+
)
320+
)
321+
),
322+
responses: [
323+
new OA\Response(
324+
response: 201,
325+
description: 'Image uploaded successfully',
326+
content: new OA\JsonContent(
327+
type: 'object',
328+
properties: [
329+
new OA\Property(property: 'id', type: 'integer', example: 1),
330+
new OA\Property(property: 'url', type: 'string', example: 'https://example.com/images/badge-feature.png'),
331+
]
332+
)
333+
),
334+
new OA\Response(response: 400, ref: '#/components/responses/400'),
335+
new OA\Response(response: 401, ref: '#/components/responses/401'),
336+
new OA\Response(response: 403, ref: '#/components/responses/403'),
337+
new OA\Response(response: 404, ref: '#/components/responses/404'),
338+
new OA\Response(response: 412, ref: '#/components/responses/412'),
339+
new OA\Response(response: 500, ref: '#/components/responses/500'),
340+
]
341+
)]
342+
343+
#[OA\Delete(
344+
path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image',
345+
summary: 'Delete the image from a badge feature type',
346+
description: 'Removes the associated image from a badge feature type.',
347+
security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]],
348+
tags: ['Badge Feature Types'],
349+
parameters: [
350+
new OA\Parameter(
351+
name: 'id',
352+
in: 'path',
353+
required: true,
354+
description: 'Summit ID',
355+
schema: new OA\Schema(type: 'integer')
356+
),
357+
new OA\Parameter(
358+
name: 'feature_id',
359+
in: 'path',
360+
required: true,
361+
description: 'Badge Feature Type ID',
362+
schema: new OA\Schema(type: 'integer')
363+
),
364+
],
365+
responses: [
366+
new OA\Response(
367+
response: 204,
368+
description: 'Image deleted successfully'
369+
),
370+
new OA\Response(response: 400, ref: '#/components/responses/400'),
371+
new OA\Response(response: 401, ref: '#/components/responses/401'),
372+
new OA\Response(response: 403, ref: '#/components/responses/403'),
373+
new OA\Response(response: 404, ref: '#/components/responses/404'),
374+
new OA\Response(response: 412, ref: '#/components/responses/412'),
375+
new OA\Response(response: 500, ref: '#/components/responses/500'),
376+
]
377+
)]
66378

67379
/**
68380
* @return array
@@ -249,4 +561,4 @@ public function deleteFeatureImage($summit_id, $feature_id) {
249561
return $this->error500($ex);
250562
}
251563
}
252-
}
564+
}

app/Swagger/schemas.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class RSVPUpdateRequestSchema_{
371371
type: 'object',
372372
properties: [
373373
new OA\Property(property: 'attendee_id', type: 'integer', example: 123),
374-
new OA\Property(property: 'seet_type', type: 'string', example: RSVP::SeatTypeRegular),
374+
new OA\Property(property: 'seat_type', type: 'string', example: RSVP::SeatTypeRegular),
375375

376376
]
377377
)]

0 commit comments

Comments
 (0)