Skip to content

Commit eab31b8

Browse files
Feature | Extend Swagger Coverage for controller OAuth2PresentationCategoryGroupController (#431)
* feat: Extend Swagger Coverage for controller `OAuth2PresentationCategoryGroupController` * fix: add missing schemas names and fields * chore: add missing request and response schemas Signed-off-by: Matias Perrone <github@matiasperrone.com> --------- Signed-off-by: Matias Perrone <github@matiasperrone.com> Co-authored-by: Matias Perrone <github@matiasperrone.com>
1 parent 14c5b84 commit eab31b8

6 files changed

Lines changed: 586 additions & 26 deletions

File tree

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

Lines changed: 341 additions & 1 deletion
Large diffs are not rendered by default.

app/ModelSerializers/Summit/Presentation/PresentationCategorySerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,4 @@ public function serialize($expand = null, array $fields = [], array $relations =
247247

248248
return $values;
249249
}
250-
}
250+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
8+
#[OA\Schema(
9+
schema: 'PresentationCategoryGroup',
10+
type: 'object',
11+
required: ['id', 'created', 'last_edited', 'name', 'class_name', 'summit_id', 'max_attendee_votes'],
12+
properties: [
13+
new OA\Property(property: 'id', type: 'integer', example: 1),
14+
new OA\Property(property: 'created', type: 'integer', example: 1634567890),
15+
new OA\Property(property: 'last_edited', type: 'integer', example: 1634567890),
16+
new OA\Property(property: 'name', type: 'string', example: 'Track Group Name'),
17+
new OA\Property(property: 'color', type: 'string', example: '#FF5733'),
18+
new OA\Property(property: 'description', type: 'string', example: 'Group description'),
19+
new OA\Property(property: 'class_name', type: 'string', example: 'PresentationCategoryGroup'),
20+
new OA\Property(property: 'summit_id', type: 'integer', example: 1),
21+
new OA\Property(property: 'begin_attendee_voting_period_date', type: 'integer', example: 1634567890),
22+
new OA\Property(property: 'end_attendee_voting_period_date', type: 'integer', example: 1634567890),
23+
new OA\Property(property: 'max_attendee_votes', type: 'integer', example: 3),
24+
new OA\Property(
25+
property: 'tracks',
26+
type: 'array',
27+
items: new OA\Items(
28+
anyOf: [
29+
new OA\Schema(type: 'integer'),
30+
new OA\Schema(ref: '#/components/schemas/PresentationCategory')
31+
]
32+
)
33+
),
34+
]
35+
)]
36+
class PresentationCategoryGroupSchema {}
Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,84 @@
11
<?php
2+
23
namespace App\Swagger\schemas;
34

45
use OpenApi\Attributes as OA;
56

7+
68
#[OA\Schema(
7-
schema: "PresentationCategory",
8-
description: "Summit Track/Presentation Category. Expandable relations: , allowed_tags, allowed_access_levels, extra_questions, proposed_schedule_allowed_locations, parent, subtracks",
9-
type: "object",
9+
schema: 'PresentationCategory',
10+
type: 'object',
1011
properties: [
11-
new OA\Property(property: "id", description: "Track ID", type: "integer", format: "int64"),
12-
new OA\Property(property: "name", description: "Track Name", type: "string"),
13-
new OA\Property(property: "description", description: "Track Description", type: "string"),
14-
new OA\Property(property: "code", description: "Track Code", type: "string"),
15-
new OA\Property(property: "group_name", description: "Track Group Name", type: "string"),
16-
new OA\Property(property: "color", description: "Track Color", type: "string"),
17-
new OA\Property(property: "session_count", description: "Number of Sessions", type: "integer"),
18-
new OA\Property(property: "voting_visible", description: "Is Voting Visible", type: "boolean"),
19-
new OA\Property(property: "chair_visible", description: "Is Chair Visible", type: "boolean"),
20-
new OA\Property(property: "has_parent", description: "Has Parent Track", type: "boolean"),
21-
new OA\Property(property: "has_subtracks", description: "Has Sub-Tracks", type: "boolean"),
22-
new OA\Property(property: "has_proposed_schedule_allowed_locations", description: "Has Proposed Schedule Allowed Locations", type: "boolean"),
23-
new OA\Property(property: "created", description: "Creation Timestamp", type: "integer", format: "int64"),
24-
new OA\Property(property: "last_edited", description: "Last Edit Timestamp", type: "integer", format: "int64"),
25-
new OA\Property(
26-
property: "icon",
27-
type: "object",
28-
description: "Track icon (see File schema)"
12+
new OA\Property(property: 'id', type: 'integer', example: 1),
13+
new OA\Property(property: 'created', type: 'integer', example: 1, format: "time_epoch"),
14+
new OA\Property(property: 'last_edited', type: 'integer', example: 1, format: "time_epoch"),
15+
new OA\Property(property: 'name', type: 'string'),
16+
new OA\Property(property: 'description', type: 'string'),
17+
new OA\Property(property: 'code', type: 'string'),
18+
new OA\Property(property: 'slug', type: 'string'),
19+
new OA\Property(property: 'session_count', type: 'integer'),
20+
new OA\Property(property: 'alternate_count', type: 'integer'),
21+
new OA\Property(property: 'lightning_count', type: 'integer'),
22+
new OA\Property(property: 'lightning_alternate_count', type: 'integer'),
23+
new OA\Property(property: 'voting_visible', type: 'boolean'),
24+
new OA\Property(property: 'chair_visible', type: 'boolean'),
25+
new OA\Property(property: 'summit_id', type: 'integer'),
26+
new OA\Property(property: 'color', type: 'string'),
27+
new OA\Property(property: 'text_color', type: 'string'),
28+
new OA\Property(property: 'icon_url', type: 'string'),
29+
new OA\Property(property: 'order', type: 'integer'),
30+
new OA\Property(property: 'proposed_schedule_transition_time', type: 'integer'),
31+
new OA\Property(property: 'parent_id', type: 'integer'),
32+
new OA\Property(property: 'track_groups', type: 'array',
33+
items: new OA\Items(
34+
anyOf: [
35+
new OA\Schema(type: 'integer'),
36+
new OA\Schema(ref: '#/components/schemas/PresentationCategoryGroup')
37+
]
38+
),
39+
description: 'PresentationCategoryGroup full objects if expanded'
40+
),
41+
new OA\Property(property: 'allowed_tags', type: 'array',
42+
items: new OA\Items(
43+
anyOf: [
44+
new OA\Schema(type: 'integer'),
45+
// new OA\Schema(ref: '#/components/schemas/Tag')
46+
]
47+
),
48+
description: 'Tag full objects if expanded'
49+
),
50+
new OA\Property(property: 'extra_questions', type: 'array',
51+
items: new OA\Items(
52+
anyOf: [
53+
new OA\Schema(type: 'integer'),
54+
// new OA\Schema(ref: '#/components/schemas/TrackQuestionTemplate')
55+
]
56+
),
57+
description: 'TrackQuestionTemplate full objects if expanded'
58+
),
59+
new OA\Property(property: 'selection_lists', type: 'array', items: new OA\Items(type: 'integer'),),
60+
new OA\Property(property: 'allowed_access_levels', type: 'array', items: new OA\Items(type: 'integer'), description: 'SummitAccessLevelType IDs, or full objects if expanded'),
61+
new OA\Property(property: 'proposed_schedule_allowed_locations', type: 'array',
62+
items: new OA\Items(
63+
anyOf: [
64+
new OA\Schema(type: 'integer'),
65+
// new OA\Schema(ref: '#/components/schemas/SummitProposedScheduleAllowedLocation')
66+
]
67+
),
68+
description: 'SummitProposedScheduleAllowedLocation full objects if expanded'
69+
),
70+
new OA\Property(property: 'parent', ref: '#/components/schemas/PresentationCategory', description: 'PresentationCategory full object if expanded'),
71+
new OA\Property(property: 'subtracks', type: 'array',
72+
items: new OA\Items(
73+
anyOf: [
74+
new OA\Schema(type: 'integer'),
75+
new OA\Schema(ref: '#/components/schemas/PresentationCategory')
76+
]
77+
),
78+
description: 'PresentationCategory full object if expanded'
2979
),
30-
]
31-
)]
32-
class PresentationCategorySchema {}
80+
])
81+
]
82+
class PresentationCategorySchema
83+
{
84+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use OpenApi\Attributes as OA;
6+
7+
#[OA\Schema(
8+
schema: 'PaginatedPresentationCategoryGroupsResponse',
9+
type: 'object',
10+
description: 'Paginated response containing presentation category groups (track groups)',
11+
allOf: [
12+
new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'),
13+
new OA\Schema(
14+
type: 'object',
15+
properties: [
16+
new OA\Property(
17+
property: 'data',
18+
type: 'array',
19+
items: new OA\Items(ref: '#/components/schemas/PresentationCategoryGroup'),
20+
description: 'Array of presentation category groups'
21+
)
22+
]
23+
)
24+
]
25+
)]
26+
class PaginatedPresentationCategoryGroupsResponseSchema {}
27+
28+
#[OA\Schema(
29+
schema: 'PresentationCategoryGroupRequest',
30+
type: 'object',
31+
description: 'Request body for creating or updating a presentation category group (track group)',
32+
required: ['name', 'class_name'],
33+
properties: [
34+
new OA\Property(
35+
property: 'class_name',
36+
type: 'string',
37+
description: 'The class name of the category group',
38+
enum: ['PresentationCategoryGroup', 'PrivatePresentationCategoryGroup'],
39+
example: 'PresentationCategoryGroup'
40+
),
41+
new OA\Property(
42+
property: 'name',
43+
type: 'string',
44+
description: 'The name of the track group',
45+
example: 'Track Group Name'
46+
),
47+
new OA\Property(
48+
property: 'description',
49+
type: 'string',
50+
description: 'The description of the track group',
51+
example: 'Track group description'
52+
),
53+
new OA\Property(
54+
property: 'color',
55+
type: 'string',
56+
description: 'The color of the track group in hex format',
57+
example: '#FF5733'
58+
),
59+
new OA\Property(
60+
property: 'max_attendee_votes',
61+
type: 'integer',
62+
description: 'Maximum number of votes allowed per attendee',
63+
minimum: 0,
64+
example: 3
65+
),
66+
new OA\Property(
67+
property: 'begin_attendee_voting_period_date',
68+
type: 'integer',
69+
description: 'Start date of attendee voting period (Unix timestamp)',
70+
format: 'int64',
71+
example: 1634567890
72+
),
73+
new OA\Property(
74+
property: 'end_attendee_voting_period_date',
75+
type: 'integer',
76+
description: 'End date of attendee voting period (Unix timestamp). Must be after begin_attendee_voting_period_date',
77+
format: 'int64',
78+
example: 1634654290
79+
),
80+
new OA\Property(
81+
property: 'submission_begin_date',
82+
type: 'integer',
83+
description: 'Start date of submission period (Unix timestamp). Only for PrivatePresentationCategoryGroup',
84+
format: 'int64',
85+
example: 1634567890
86+
),
87+
new OA\Property(
88+
property: 'submission_end_date',
89+
type: 'integer',
90+
description: 'End date of submission period (Unix timestamp). Only for PrivatePresentationCategoryGroup. Must be after submission_begin_date',
91+
format: 'int64',
92+
example: 1634654290
93+
),
94+
new OA\Property(
95+
property: 'max_submission_allowed_per_user',
96+
type: 'integer',
97+
description: 'Maximum number of submissions allowed per user. Only for PrivatePresentationCategoryGroup',
98+
minimum: 1,
99+
example: 5
100+
),
101+
]
102+
)]
103+
class PresentationCategoryGroupRequestSchema {}
104+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Swagger\schemas;
4+
5+
use App\Security\SummitScopes;
6+
use OpenApi\Attributes as OA;
7+
8+
#[OA\SecurityScheme(
9+
type: 'oauth2',
10+
securityScheme: 'track_groups_oauth2',
11+
flows: [
12+
new OA\Flow(
13+
authorizationUrl: L5_SWAGGER_CONST_AUTH_URL,
14+
tokenUrl: L5_SWAGGER_CONST_TOKEN_URL,
15+
flow: 'authorizationCode',
16+
scopes: [
17+
SummitScopes::ReadSummitData => 'Read Summit Data',
18+
SummitScopes::ReadAllSummitData => 'Read All Summit Data',
19+
SummitScopes::WriteSummitData => 'Write Summit Data',
20+
SummitScopes::WriteTrackGroupsData => 'Write Track Groups Data',
21+
],
22+
),
23+
],
24+
)
25+
]
26+
class TrackGroupsAuthSchema
27+
{
28+
}

0 commit comments

Comments
 (0)