From ce3e450e9e14480923ed1b70bc608422e131493a Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 2 Oct 2025 12:36:36 -0300 Subject: [PATCH 01/12] feat: Extend Swagger Coverage for controller Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php --- ...OAuth2SummitMediaFileTypeApiController.php | 179 +++++++++++++++++- 1 file changed, 178 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 4fe2a7105..50843cad6 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -12,10 +12,12 @@ * limitations under the License. **/ use App\Models\Foundation\Summit\Repositories\ISummitMediaFileTypeRepository; +use App\Security\SummitScopes; use App\Services\Model\ISummitMediaFileTypeService; use models\oauth2\IResourceServerContext; use models\utils\IEntity; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; /** * Class OAuth2SummitMediaFileTypeApiController * @package App\Http\Controllers @@ -55,6 +57,181 @@ public function __construct $this->repository = $repository; } + // OpenAPI Documentation + + #[OA\Get( + path: '/api/v1/summit-media-file-types', + summary: 'Get all summit media file types', + description: 'Retrieves a paginated list of summit media file types. Media file types define categories of files that can be uploaded to summits (e.g., presentations, videos, documents) along with their allowed file extensions.', + security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + tags: ['Summit Media File Types'], + parameters: [ + new OA\Parameter( + name: 'page', + in: 'query', + required: false, + description: 'Page number for pagination', + schema: new OA\Schema(type: 'integer', example: 1) + ), + new OA\Parameter( + name: 'per_page', + in: 'query', + required: false, + description: 'Items per page', + schema: new OA\Schema(type: 'integer', example: 10, maximum: 100) + ), + new OA\Parameter( + name: 'filter[]', + in: 'query', + required: false, + description: 'Filter expressions. Format: fieldvalue. Available field: name (=@, ==). Operators: == (equals), =@ (starts with)', + style: 'form', + explode: true, + schema: new OA\Schema( + type: 'array', + items: new OA\Items(type: 'string', example: 'name@@presentation') + ) + ), + new OA\Parameter( + name: 'order', + in: 'query', + required: false, + description: 'Order by field(s). Available fields: name, id. Use "-" prefix for descending order.', + schema: new OA\Schema(type: 'string', example: 'name') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Media file types retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/PaginatedSummitMediaFileTypesResponse') + ), + new OA\Response(response: 400, ref: '#/components/responses/400'), + new OA\Response(response: 401, ref: '#/components/responses/401'), + new OA\Response(response: 403, ref: '#/components/responses/403'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] + + #[OA\Get( + path: '/api/v1/summit-media-file-types/{id}', + summary: 'Get a summit media file type by ID', + description: 'Retrieves detailed information about a specific summit media file type.', + security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + tags: ['Summit Media File Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit Media File Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Media file type retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileType') + ), + new OA\Response(response: 400, ref: '#/components/responses/400'), + new OA\Response(response: 401, ref: '#/components/responses/401'), + new OA\Response(response: 403, ref: '#/components/responses/403'), + new OA\Response(response: 404, ref: '#/components/responses/404'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] + + #[OA\Post( + path: '/api/v1/summit-media-file-types', + summary: 'Create a new summit media file type', + description: 'Creates a new summit media file type with specified name, description, and allowed file extensions.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Summit Media File Types'], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileTypeCreateRequest') + ), + responses: [ + new OA\Response( + response: 201, + description: 'Media file type created successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileType') + ), + new OA\Response(response: 400, ref: '#/components/responses/400'), + new OA\Response(response: 401, ref: '#/components/responses/401'), + new OA\Response(response: 403, ref: '#/components/responses/403'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 422, ref: '#/components/responses/422'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] + + #[OA\Put( + path: '/api/v1/summit-media-file-types/{id}', + summary: 'Update a summit media file type', + description: 'Updates an existing summit media file type.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Summit Media File Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit Media File Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileTypeUpdateRequest') + ), + responses: [ + new OA\Response( + response: 200, + description: 'Media file type updated successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileType') + ), + new OA\Response(response: 400, ref: '#/components/responses/400'), + new OA\Response(response: 401, ref: '#/components/responses/401'), + new OA\Response(response: 403, ref: '#/components/responses/403'), + new OA\Response(response: 404, ref: '#/components/responses/404'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 422, ref: '#/components/responses/422'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] + + #[OA\Delete( + path: '/api/v1/summit-media-file-types/{id}', + summary: 'Delete a summit media file type', + description: 'Deletes an existing summit media file type. System-defined types cannot be deleted.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Summit Media File Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit Media File Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + responses: [ + new OA\Response( + response: 204, + description: 'Media file type deleted successfully' + ), + new OA\Response(response: 400, ref: '#/components/responses/400'), + new OA\Response(response: 401, ref: '#/components/responses/401'), + new OA\Response(response: 403, ref: '#/components/responses/403'), + new OA\Response(response: 404, ref: '#/components/responses/404'), + new OA\Response(response: 412, ref: '#/components/responses/412'), + new OA\Response(response: 500, ref: '#/components/responses/500'), + ] + )] /** * @inheritDoc @@ -139,4 +316,4 @@ function(){ } ); } -} \ No newline at end of file +} From 20ca71d192429cc9e6994ebbd356782f32cf5bfa Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 19:01:14 -0300 Subject: [PATCH 02/12] fix: incorrect types and descriptions for errors --- .../Summit/OAuth2SummitMediaFileTypeApiController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 50843cad6..e98f6ccae 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -18,6 +18,7 @@ use models\utils\IEntity; use ModelSerializers\SerializerRegistry; use OpenApi\Attributes as OA; +use Symfony\Component\HttpFoundation\Response; /** * Class OAuth2SummitMediaFileTypeApiController * @package App\Http\Controllers @@ -106,11 +107,11 @@ public function __construct description: 'Media file types retrieved successfully', content: new OA\JsonContent(ref: '#/components/schemas/PaginatedSummitMediaFileTypesResponse') ), - new OA\Response(response: 400, ref: '#/components/responses/400'), - new OA\Response(response: 401, ref: '#/components/responses/401'), - new OA\Response(response: 403, ref: '#/components/responses/403'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] From dcbcf5a42f4417846a55f1083b85fe94e9c5d1c0 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 19:07:06 -0300 Subject: [PATCH 03/12] fix: incorrect types and descriptions for errors --- ...OAuth2SummitMediaFileTypeApiController.php | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index e98f6ccae..4fe9e4a4c 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -136,12 +136,12 @@ public function __construct description: 'Media file type retrieved successfully', content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileType') ), - new OA\Response(response: 400, ref: '#/components/responses/400'), - new OA\Response(response: 401, ref: '#/components/responses/401'), - new OA\Response(response: 403, ref: '#/components/responses/403'), - new OA\Response(response: 404, ref: '#/components/responses/404'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -161,12 +161,13 @@ public function __construct description: 'Media file type created successfully', content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileType') ), - new OA\Response(response: 400, ref: '#/components/responses/400'), - new OA\Response(response: 401, ref: '#/components/responses/401'), - new OA\Response(response: 403, ref: '#/components/responses/403'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 422, ref: '#/components/responses/422'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_UNPROCESSABLE_ENTITY, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -195,13 +196,12 @@ public function __construct description: 'Media file type updated successfully', content: new OA\JsonContent(ref: '#/components/schemas/SummitMediaFileType') ), - new OA\Response(response: 400, ref: '#/components/responses/400'), - new OA\Response(response: 401, ref: '#/components/responses/401'), - new OA\Response(response: 403, ref: '#/components/responses/403'), - new OA\Response(response: 404, ref: '#/components/responses/404'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 422, ref: '#/components/responses/422'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_UNPROCESSABLE_ENTITY, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -225,12 +225,13 @@ public function __construct response: 204, description: 'Media file type deleted successfully' ), - new OA\Response(response: 400, ref: '#/components/responses/400'), - new OA\Response(response: 401, ref: '#/components/responses/401'), - new OA\Response(response: 403, ref: '#/components/responses/403'), - new OA\Response(response: 404, ref: '#/components/responses/404'), - new OA\Response(response: 412, ref: '#/components/responses/412'), - new OA\Response(response: 500, ref: '#/components/responses/500'), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_UNPROCESSABLE_ENTITY, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] From 4ffd33d79c19c7bcb45417f1bb423897ea1f4494 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 8 Oct 2025 19:07:14 -0300 Subject: [PATCH 04/12] fix: Move schema to the new file --- app/Swagger/SummitSchemas.php | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/app/Swagger/SummitSchemas.php b/app/Swagger/SummitSchemas.php index 6b3e2f895..4e647f131 100644 --- a/app/Swagger/SummitSchemas.php +++ b/app/Swagger/SummitSchemas.php @@ -5,3 +5,76 @@ use OpenApi\Attributes as OA; // + +#[OA\Schema( + schema: 'SummitMediaFileType', + type: 'object', + properties: [ + new OA\Property(property: 'id', type: 'integer', example: 1), + new OA\Property(property: 'created', type: 'integer', format: 'int64', example: 1633024800), + new OA\Property(property: 'last_edited', type: 'integer', format: 'int64', example: 1633024800), + new OA\Property(property: 'name', type: 'string', example: 'Presentation'), + new OA\Property(property: 'description', type: 'string', example: 'Presentation files for events'), + new OA\Property(property: 'is_system_defined', type: 'boolean', example: false), + new OA\Property( + property: 'allowed_extensions', + type: 'array', + items: new OA\Items(type: 'string'), + example: ['pdf', 'ppt', 'pptx'] + ), + ] +)] +class SummitMediaFileTypeSchema {} + +#[OA\Schema( + schema: 'PaginatedSummitMediaFileTypesResponse', + allOf: [ + new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'), + new OA\Schema( + properties: [ + new OA\Property( + property: 'data', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/SummitMediaFileType') + ) + ] + ) + ] +)] +class PaginatedSummitMediaFileTypesResponseSchema {} + +#[OA\Schema( + schema: 'SummitMediaFileTypeCreateRequest', + required: ['name', 'allowed_extensions'], + type: 'object', + properties: [ + new OA\Property(property: 'name', type: 'string', maxLength: 255, example: 'Presentation'), + new OA\Property(property: 'description', type: 'string', maxLength: 255, example: 'Presentation files for events'), + new OA\Property( + property: 'allowed_extensions', + type: 'array', + items: new OA\Items(type: 'string'), + example: ['pdf', 'ppt', 'pptx'], + description: 'Array of allowed file extensions' + ), + ] +)] +class SummitMediaFileTypeCreateRequestSchema {} + +#[OA\Schema( + schema: 'SummitMediaFileTypeUpdateRequest', + required: ['allowed_extensions'], + type: 'object', + properties: [ + new OA\Property(property: 'name', type: 'string', maxLength: 255, example: 'Presentation'), + new OA\Property(property: 'description', type: 'string', maxLength: 255, example: 'Presentation files for events'), + new OA\Property( + property: 'allowed_extensions', + type: 'array', + items: new OA\Items(type: 'string'), + example: ['pdf', 'ppt', 'pptx'], + description: 'Array of allowed file extensions' + ), + ] +)] +class SummitMediaFileTypeUpdateRequestSchema {} From 6c08e1db95b4d13952a79169c57ca695baafb254 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 14 Oct 2025 14:22:35 -0300 Subject: [PATCH 05/12] fix: Change "namespace" word positioning --- .../Summit/OAuth2SummitMediaFileTypeApiController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 4fe9e4a4c..2476cf077 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -1,4 +1,7 @@ - Date: Fri, 31 Oct 2025 15:31:04 -0300 Subject: [PATCH 06/12] fix: add the right security schema --- .../Summit/OAuth2SummitMediaFileTypeApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 2476cf077..2ebe78616 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -67,7 +67,7 @@ public function __construct path: '/api/v1/summit-media-file-types', summary: 'Get all summit media file types', description: 'Retrieves a paginated list of summit media file types. Media file types define categories of files that can be uploaded to summits (e.g., presentations, videos, documents) along with their allowed file extensions.', - security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + security: [['Bearer' => [SummitScopes::ReadAllSummitData]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( @@ -321,4 +321,4 @@ function(){ } ); } -} \ No newline at end of file +} From 386caa2841eeb07d648f9ff832c00d3433d348a2 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 7 Nov 2025 21:51:31 +0000 Subject: [PATCH 07/12] fix: security scopes --- .../Summit/OAuth2SummitMediaFileTypeApiController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 2ebe78616..b08d116bf 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -67,7 +67,7 @@ public function __construct path: '/api/v1/summit-media-file-types', summary: 'Get all summit media file types', description: 'Retrieves a paginated list of summit media file types. Media file types define categories of files that can be uploaded to summits (e.g., presentations, videos, documents) along with their allowed file extensions.', - security: [['Bearer' => [SummitScopes::ReadAllSummitData]]], + security: [['Bearer' => [SummitScopes::ReadSummitMediaFileTypes]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( @@ -122,7 +122,7 @@ public function __construct path: '/api/v1/summit-media-file-types/{id}', summary: 'Get a summit media file type by ID', description: 'Retrieves detailed information about a specific summit media file type.', - security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + security: [['oauth2_security_scope' => [SummitScopes::ReadSummitMediaFileTypes]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( @@ -152,7 +152,7 @@ public function __construct path: '/api/v1/summit-media-file-types', summary: 'Create a new summit media file type', description: 'Creates a new summit media file type with specified name, description, and allowed file extensions.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitMediaFileTypes]]], tags: ['Summit Media File Types'], requestBody: new OA\RequestBody( required: true, @@ -178,7 +178,7 @@ public function __construct path: '/api/v1/summit-media-file-types/{id}', summary: 'Update a summit media file type', description: 'Updates an existing summit media file type.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitMediaFileTypes]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( @@ -212,7 +212,7 @@ public function __construct path: '/api/v1/summit-media-file-types/{id}', summary: 'Delete a summit media file type', description: 'Deletes an existing summit media file type. System-defined types cannot be deleted.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitMediaFileTypes]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( From 66ff30003213f1fa00e061bc3d6ecd6f21517959 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 7 Nov 2025 21:53:54 +0000 Subject: [PATCH 08/12] fix: security scopes array name --- .../Protected/Summit/OAuth2SummitMediaFileTypeApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index b08d116bf..c7dead748 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -67,7 +67,7 @@ public function __construct path: '/api/v1/summit-media-file-types', summary: 'Get all summit media file types', description: 'Retrieves a paginated list of summit media file types. Media file types define categories of files that can be uploaded to summits (e.g., presentations, videos, documents) along with their allowed file extensions.', - security: [['Bearer' => [SummitScopes::ReadSummitMediaFileTypes]]], + security: [['oauth2_security_scope' => [SummitScopes::ReadSummitMediaFileTypes]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( From f3b9af2da4a355085ac4e85f77250f6130ba8fe5 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 11 Nov 2025 21:59:58 +0000 Subject: [PATCH 09/12] fix: Security schema --- ...OAuth2SummitMediaFileTypeApiController.php | 79 +++++++++++++++++-- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index c7dead748..d0ec15241 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ +use App\Models\Foundation\Main\IGroup; use App\Models\Foundation\Summit\Repositories\ISummitMediaFileTypeRepository; use App\Security\SummitScopes; use App\Services\Model\ISummitMediaFileTypeService; @@ -22,6 +23,27 @@ use ModelSerializers\SerializerRegistry; use OpenApi\Attributes as OA; use Symfony\Component\HttpFoundation\Response; + + +#[OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'summit_media_file_type_oauth2', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + SummitScopes::ReadSummitMediaFileTypes => 'Read Summit Media File Types', + SummitScopes::WriteSummitMediaFileTypes => 'Write Summit Media File Types', + ], + ), + ], + ) +] +class SummitMediaFileTypeAuthSchema{} + + /** * Class OAuth2SummitMediaFileTypeApiController * @package App\Http\Controllers @@ -67,8 +89,17 @@ public function __construct path: '/api/v1/summit-media-file-types', summary: 'Get all summit media file types', description: 'Retrieves a paginated list of summit media file types. Media file types define categories of files that can be uploaded to summits (e.g., presentations, videos, documents) along with their allowed file extensions.', - security: [['oauth2_security_scope' => [SummitScopes::ReadSummitMediaFileTypes]]], - tags: ['Summit Media File Types'], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], + security: [['summit_media_file_type_oauth2' => [ + SummitScopes::ReadSummitMediaFileTypes + ]]], + tags: ['Files'], parameters: [ new OA\Parameter( name: 'page', @@ -122,7 +153,16 @@ public function __construct path: '/api/v1/summit-media-file-types/{id}', summary: 'Get a summit media file type by ID', description: 'Retrieves detailed information about a specific summit media file type.', - security: [['oauth2_security_scope' => [SummitScopes::ReadSummitMediaFileTypes]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], + security: [['summit_media_file_type_oauth2' => [ + SummitScopes::ReadSummitMediaFileTypes + ]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( @@ -152,7 +192,16 @@ public function __construct path: '/api/v1/summit-media-file-types', summary: 'Create a new summit media file type', description: 'Creates a new summit media file type with specified name, description, and allowed file extensions.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitMediaFileTypes]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], + security: [['summit_media_file_type_oauth2' => [ + SummitScopes::WriteSummitMediaFileTypes + ]]], tags: ['Summit Media File Types'], requestBody: new OA\RequestBody( required: true, @@ -178,7 +227,16 @@ public function __construct path: '/api/v1/summit-media-file-types/{id}', summary: 'Update a summit media file type', description: 'Updates an existing summit media file type.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitMediaFileTypes]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], + security: [['summit_media_file_type_oauth2' => [ + SummitScopes::WriteSummitMediaFileTypes + ]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( @@ -212,7 +270,16 @@ public function __construct path: '/api/v1/summit-media-file-types/{id}', summary: 'Delete a summit media file type', description: 'Deletes an existing summit media file type. System-defined types cannot be deleted.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitMediaFileTypes]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], + security: [['summit_media_file_type_oauth2' => [ + SummitScopes::WriteSummitMediaFileTypes + ]]], tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( From 8953b6340741e7ec6ce70eb9af284cfbb95a7f44 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 19:50:29 +0000 Subject: [PATCH 10/12] chore: Move the security schema for the controller to its own file --- ...OAuth2SummitMediaFileTypeApiController.php | 20 -------------- .../SummitMediaFileTypeAuthSchema.php | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 app/Swagger/Security/SummitMediaFileTypeAuthSchema.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index d0ec15241..6ecaf9d2e 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -24,26 +24,6 @@ use OpenApi\Attributes as OA; use Symfony\Component\HttpFoundation\Response; - -#[OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'summit_media_file_type_oauth2', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - SummitScopes::ReadSummitMediaFileTypes => 'Read Summit Media File Types', - SummitScopes::WriteSummitMediaFileTypes => 'Write Summit Media File Types', - ], - ), - ], - ) -] -class SummitMediaFileTypeAuthSchema{} - - /** * Class OAuth2SummitMediaFileTypeApiController * @package App\Http\Controllers diff --git a/app/Swagger/Security/SummitMediaFileTypeAuthSchema.php b/app/Swagger/Security/SummitMediaFileTypeAuthSchema.php new file mode 100644 index 000000000..032233c54 --- /dev/null +++ b/app/Swagger/Security/SummitMediaFileTypeAuthSchema.php @@ -0,0 +1,26 @@ + 'Read Summit Media File Types', + SummitScopes::WriteSummitMediaFileTypes => 'Write Summit Media File Types', + ], + ), + ], + ) +] +class SummitMediaFileTypeAuthSchema{} From 968b01ffa8c74a139aba04845f6d5af5464ea492 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 20 Nov 2025 22:14:32 +0000 Subject: [PATCH 11/12] chore: change all tags to be **'Summit Media File Types'** --- .../Protected/Summit/OAuth2SummitMediaFileTypeApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 6ecaf9d2e..84e05ffde 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -79,7 +79,7 @@ public function __construct security: [['summit_media_file_type_oauth2' => [ SummitScopes::ReadSummitMediaFileTypes ]]], - tags: ['Files'], + tags: ['Summit Media File Types'], parameters: [ new OA\Parameter( name: 'page', From 66254fb4009243af676b143d738f326b651d0057 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 20 Nov 2025 22:18:48 +0000 Subject: [PATCH 12/12] chore: add requested changes in PR --- .../Summit/OAuth2SummitMediaFileTypeApiController.php | 5 +++++ app/Swagger/SummitSchemas.php | 1 + 2 files changed, 6 insertions(+) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php index 84e05ffde..9c806e624 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php @@ -67,6 +67,7 @@ public function __construct #[OA\Get( path: '/api/v1/summit-media-file-types', + operationId: 'getAllSummitMediaFileTypes', summary: 'Get all summit media file types', description: 'Retrieves a paginated list of summit media file types. Media file types define categories of files that can be uploaded to summits (e.g., presentations, videos, documents) along with their allowed file extensions.', x: [ @@ -131,6 +132,7 @@ public function __construct #[OA\Get( path: '/api/v1/summit-media-file-types/{id}', + operationId: 'getSummitMediaFileType', summary: 'Get a summit media file type by ID', description: 'Retrieves detailed information about a specific summit media file type.', x: [ @@ -170,6 +172,7 @@ public function __construct #[OA\Post( path: '/api/v1/summit-media-file-types', + operationId: 'createSummitMediaFileType', summary: 'Create a new summit media file type', description: 'Creates a new summit media file type with specified name, description, and allowed file extensions.', x: [ @@ -205,6 +208,7 @@ public function __construct #[OA\Put( path: '/api/v1/summit-media-file-types/{id}', + operationId: 'updateSummitMediaFileType', summary: 'Update a summit media file type', description: 'Updates an existing summit media file type.', x: [ @@ -248,6 +252,7 @@ public function __construct #[OA\Delete( path: '/api/v1/summit-media-file-types/{id}', + operationId: 'deleteSummitMediaFileType', summary: 'Delete a summit media file type', description: 'Deletes an existing summit media file type. System-defined types cannot be deleted.', x: [ diff --git a/app/Swagger/SummitSchemas.php b/app/Swagger/SummitSchemas.php index 4e647f131..3803ca47b 100644 --- a/app/Swagger/SummitSchemas.php +++ b/app/Swagger/SummitSchemas.php @@ -28,6 +28,7 @@ class SummitMediaFileTypeSchema {} #[OA\Schema( schema: 'PaginatedSummitMediaFileTypesResponse', + type: 'object', allOf: [ new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'), new OA\Schema(