From 325dbc250ffd8be47ab21ba61cf7ce0f32656cfc Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 12:53:12 -0300 Subject: [PATCH 1/9] feat: Extend Swagger Coverage for controller `OAuth2SummitMediaUploadTypeApiController` --- ...uth2SummitMediaUploadTypeApiController.php | 319 +++++++++++++++++- app/Swagger/SummitSchemas.php | 128 +++++++ 2 files changed, 429 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index 8b86470a2..d2c459bb7 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -15,11 +15,13 @@ use App\Http\Exceptions\HTTP403ForbiddenException; use App\Models\Foundation\Summit\Repositories\ISummitMediaUploadTypeRepository; use App\Services\Model\ISummitMediaUploadTypeService; +use Illuminate\Http\Response; use models\oauth2\IResourceServerContext; use models\summit\ISummitRepository; use models\summit\Summit; use models\utils\IEntity; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; /** * Class OAuth2SummitMediaUploadTypeApiController @@ -63,6 +65,209 @@ public function __construct $this->repository = $repository; } + #[OA\Get( + path: "/api/v1/summits/{id}/media-upload-types", + summary: "Get all media upload types for a summit", + description: "Returns a paginated list of media upload types configured for a specific summit. Allows ordering, filtering and pagination.", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter(ref: "#/components/parameters/page_number_param"), + new OA\Parameter(ref: "#/components/parameters/page_size_param"), + new OA\Parameter( + name: "filter[]", + in: "query", + required: false, + description: "Filter media upload types. Available filters: name (=@, ==)", + schema: new OA\Schema(type: "array", items: new OA\Items(type: "string")), + explode: true + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + description: "Order by field. Valid fields: id, name", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + description: "Expand related entities. Available expansions: type, summit, presentation_types", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + description: "Load relations. Available: presentation_types", + schema: new OA\Schema(type: "string") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Success", + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitMediaUploadTypesResponse") + ), + 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: "Summit not found"), + ] + )] + public function getAllBySummit($summit_id) + { + $this->summit_id = $summit_id; + $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($this->summit_id); + if (is_null($summit)) return $this->error404(); + return $this->getAll(); + } + + #[OA\Get( + path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", + summary: "Get a specific media upload type", + description: "Returns detailed information about a specific media upload type", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "media_upload_type_id", + in: "path", + required: true, + description: "Media upload type ID", + schema: new OA\Schema(type: "integer") + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + description: "Expand related entities. Available expansions: type, summit, presentation_types", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + description: "Load relations. Available: presentation_types", + schema: new OA\Schema(type: "string") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Success", + content: new OA\JsonContent(ref: "#/components/schemas/SummitMediaUploadType") + ), + 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"), + ] + )] + public function get($summit_id, $media_upload_type_id) + { + return $this->getById($summit_id, $media_upload_type_id); + } + + #[OA\Post( + path: "/api/v1/summits/{id}/media-upload-types", + summary: "Create a new media upload type", + description: "Creates a new media upload type for the specified summit", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/SummitMediaUploadTypeCreateRequest") + ), + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitMediaUploadType") + ), + 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: "Summit not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + ] + )] + public function add($summit_id) + { + return $this->addChild($summit_id); + } + + #[OA\Put( + path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", + summary: "Update a media upload type", + description: "Updates an existing media upload type", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "media_upload_type_id", + in: "path", + required: true, + description: "Media upload type ID", + schema: new OA\Schema(type: "integer") + ), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/SummitMediaUploadTypeUpdateRequest") + ), + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Success", + content: new OA\JsonContent(ref: "#/components/schemas/SummitMediaUploadType") + ), + 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"), + ] + )] + public function update($summit_id, $media_upload_type_id) + { + return $this->updateChild($summit_id, $media_upload_type_id); + } + + #[OA\Delete( + path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", + summary: "Delete a media upload type", + description: "Deletes a media upload type from the summit", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "media_upload_type_id", + in: "path", + required: true, + description: "Media upload type ID", + schema: new OA\Schema(type: "integer") + ), + ], + responses: [ + new OA\Response(response: Response::HTTP_NO_CONTENT, description: "Deleted successfully"), + 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"), + ] + )] + public function delete($summit_id, $media_upload_type_id) + { + return $this->deleteChild($summit_id, $media_upload_type_id); + } + /** * @return array */ @@ -182,12 +387,40 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I return $this->service->update($summit, $child_id, $payload); } - /** - * @param $summit_id - * @param $media_upload_type_id - * @param $presentation_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ + #[OA\Put( + path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}", + summary: "Add media upload type to presentation type", + description: "Associates a media upload type with a specific presentation type", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "media_upload_type_id", + in: "path", + required: true, + description: "Media upload type ID", + schema: new OA\Schema(type: "integer") + ), + new OA\Parameter( + name: "event_type_id", + in: "path", + required: true, + description: "Presentation type ID", + schema: new OA\Schema(type: "integer") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Success - Returns the updated presentation type", + content: new OA\JsonContent(type: "object") + ), + 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"), + ] + )] public function addToPresentationType($summit_id, $media_upload_type_id, $presentation_type_id){ return $this->processRequest(function() use($summit_id, $media_upload_type_id, $presentation_type_id){ $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); @@ -211,12 +444,40 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen }); } - /** - * @param $summit_id - * @param $media_upload_type_id - * @param $presentation_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ + #[OA\Delete( + path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}", + summary: "Remove media upload type from presentation type", + description: "Removes the association between a media upload type and a presentation type", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "media_upload_type_id", + in: "path", + required: true, + description: "Media upload type ID", + schema: new OA\Schema(type: "integer") + ), + new OA\Parameter( + name: "event_type_id", + in: "path", + required: true, + description: "Presentation type ID", + schema: new OA\Schema(type: "integer") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Success - Returns the updated presentation type", + content: new OA\JsonContent(type: "object") + ), + 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"), + ] + )] public function deleteFromPresentationType($summit_id, $media_upload_type_id, $presentation_type_id){ return $this->processRequest(function() use($summit_id, $media_upload_type_id, $presentation_type_id){ $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); @@ -239,11 +500,33 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p }); } - /** - * @param $summit_id - * @param $to_summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ + #[OA\Post( + path: "/api/v1/summits/{id}/media-upload-types/all/clone/{to_summit_id}", + summary: "Clone media upload types to another summit", + description: "Clones all media upload types from one summit to another summit", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Media Upload Types"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "to_summit_id", + in: "path", + required: true, + description: "Target summit ID to clone media upload types to", + schema: new OA\Schema(type: "integer") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: "Success - Returns the target summit with cloned media upload types", + content: new OA\JsonContent(type: "object") + ), + 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: "Source or target summit not found"), + ] + )] public function cloneMediaUploadTypes($summit_id, $to_summit_id){ return $this->processRequest(function() use($summit_id, $to_summit_id){ $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); @@ -276,4 +559,4 @@ public function cloneMediaUploadTypes($summit_id, $to_summit_id){ }); } -} \ No newline at end of file +} diff --git a/app/Swagger/SummitSchemas.php b/app/Swagger/SummitSchemas.php index 5f83d1c19..b08338e0f 100644 --- a/app/Swagger/SummitSchemas.php +++ b/app/Swagger/SummitSchemas.php @@ -341,6 +341,134 @@ class SummitAttendeeBadgeSchema )] class PaginatedSummitAttendeeBadgesResponseSchema {} +// Summit Media Upload Type Schemas + +#[OA\Schema( + schema: "SummitMediaUploadType", + description: "Summit Media Upload Type", + type: "object", + properties: [ + new OA\Property(property: "id", type: "integer", example: 1), + new OA\Property(property: "created", type: "integer", format: "int64", description: "Creation timestamp (epoch)", example: 1234567890), + new OA\Property(property: "last_edited", type: "integer", format: "int64", description: "Last edit timestamp (epoch)", example: 1234567890), + new OA\Property(property: "name", type: "string", maxLength: 255, example: "Speaker Photo"), + new OA\Property(property: "description", type: "string", maxLength: 5120, nullable: true, example: "High resolution photo of the speaker"), + new OA\Property(property: "max_size", type: "integer", description: "Maximum file size in KB", example: 10240), + new OA\Property(property: "is_mandatory", type: "boolean", example: true), + new OA\Property(property: "min_uploads_qty", type: "integer", minimum: 0, example: 1), + new OA\Property(property: "max_uploads_qty", type: "integer", minimum: 0, example: 1), + new OA\Property(property: "use_temporary_links_on_public_storage", type: "boolean", example: false), + new OA\Property(property: "temporary_links_public_storage_ttl", type: "integer", description: "TTL in seconds", nullable: true, example: 3600), + new OA\Property(property: "private_storage_type", type: "string", example: "local"), + new OA\Property(property: "public_storage_type", type: "string", example: "s3"), + new OA\Property(property: "type_id", type: "integer", example: 456), + new OA\Property(property: "is_editable", type: "boolean", example: true), + ], + anyOf: [ + new OA\Property(property: "summit_id", type: "integer", example: 123, description: "Summit ID, only when expand does NOT include 'summit' in it."), + new OA\Property(property: "summit", type: "Summit", description: "Summit expand (only when relations=presentation_types) and expand includes 'summit' in it."), + new OA\Property( + property: "presentation_types", + type: "array", + items: new OA\Items(type: "integer"), + description: "Array of presentation type IDs (only when relations=presentation_types and expand does not include 'presentation_types' in it)", + example: [1, 2, 3] + ), + new OA\Property( + property: "presentation_types", + type: "array", + items: new OA\Items(type: "PresentationType"), + description: "Array of PresentationType (only when relations=presentation_types and expand includes 'presentation_types' in it)", + ), + ], +)] +class SummitMediaUploadTypeSchema +{ +} + +#[OA\Schema( + schema: "PaginatedSummitMediaUploadTypesResponse", + description: "Paginated response for Summit Media Upload Types", + properties: [ + new OA\Property(property: "total", type: "integer", example: 100), + new OA\Property(property: "per_page", type: "integer", example: 15), + new OA\Property(property: "current_page", type: "integer", example: 1), + new OA\Property(property: "last_page", type: "integer", example: 7), + new OA\Property( + property: "data", + type: "array", + items: new OA\Items(ref: "#/components/schemas/SummitMediaUploadType") + ), + ], + type: "object" +)] +class PaginatedSummitMediaUploadTypesResponseSchema +{ +} + +#[OA\Schema( + schema: "SummitMediaUploadTypeCreateRequest", + description: "Request to create a Summit Media Upload Type", + required: ["name", "is_mandatory", "max_size", "private_storage_type", "public_storage_type", "type_id", "is_editable"], + properties: [ + new OA\Property(property: "name", type: "string", maxLength: 255, example: "Speaker Photo"), + new OA\Property(property: "description", type: "string", maxLength: 5120, nullable: true, example: "High resolution photo of the speaker"), + new OA\Property(property: "is_mandatory", type: "boolean", example: true), + new OA\Property(property: "max_size", type: "integer", description: "Maximum file size in KB (must be megabyte aligned)", example: 10240), + new OA\Property(property: "private_storage_type", type: "string", enum: ["local", "swift", "s3"], example: "local"), + new OA\Property(property: "public_storage_type", type: "string", enum: ["local", "swift", "s3"], example: "s3"), + new OA\Property(property: "type_id", type: "integer", example: 456), + new OA\Property(property: "is_editable", type: "boolean", example: true), + new OA\Property(property: "use_temporary_links_on_public_storage", type: "boolean", nullable: true, example: false), + new OA\Property(property: "temporary_links_public_storage_ttl", type: "integer", description: "TTL in seconds (required if use_temporary_links_on_public_storage is true)", nullable: true, example: 3600), + new OA\Property(property: "min_uploads_qty", type: "integer", minimum: 0, nullable: true, example: 1), + new OA\Property(property: "max_uploads_qty", type: "integer", minimum: 0, nullable: true, example: 1), + new OA\Property( + property: "presentation_types", + type: "array", + items: new OA\Items(type: "integer"), + description: "Array of presentation type IDs", + nullable: true, + example: [1, 2, 3] + ), + ], + type: "object" +)] +class SummitMediaUploadTypeCreateRequestSchema +{ +} + +#[OA\Schema( + schema: "SummitMediaUploadTypeUpdateRequest", + description: "Request to update a Summit Media Upload Type", + properties: [ + new OA\Property(property: "name", type: "string", maxLength: 255, nullable: true, example: "Speaker Photo"), + new OA\Property(property: "description", type: "string", maxLength: 5120, nullable: true, example: "High resolution photo of the speaker"), + new OA\Property(property: "is_mandatory", type: "boolean", nullable: true, example: true), + new OA\Property(property: "max_size", type: "integer", description: "Maximum file size in KB (must be megabyte aligned)", nullable: true, example: 10240), + new OA\Property(property: "private_storage_type", type: "string", enum: ["local", "swift", "s3"], nullable: true, example: "local"), + new OA\Property(property: "public_storage_type", type: "string", enum: ["local", "swift", "s3"], nullable: true, example: "s3"), + new OA\Property(property: "type_id", type: "integer", nullable: true, example: 456), + new OA\Property(property: "is_editable", type: "boolean", nullable: true, example: true), + new OA\Property(property: "use_temporary_links_on_public_storage", type: "boolean", nullable: true, example: false), + new OA\Property(property: "temporary_links_public_storage_ttl", type: "integer", description: "TTL in seconds (required if use_temporary_links_on_public_storage is true)", nullable: true, example: 3600), + new OA\Property(property: "min_uploads_qty", type: "integer", minimum: 0, nullable: true, example: 1), + new OA\Property(property: "max_uploads_qty", type: "integer", minimum: 0, nullable: true, example: 1), + new OA\Property( + property: "presentation_types", + type: "array", + items: new OA\Items(type: "integer"), + description: "Array of presentation type IDs", + nullable: true, + example: [1, 2, 3] + ), + ], + type: "object" +)] +class SummitMediaUploadTypeUpdateRequestSchema +{ +} + #[OA\Schema( schema: 'SummitMediaFileType', type: 'object', From 283d0e3401ec8d554e6cdf1a868ce286d438efcf Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 15:38:07 -0300 Subject: [PATCH 2/9] fix: Add missing type expand for SummitMediaFileType --- app/Swagger/SummitSchemas.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Swagger/SummitSchemas.php b/app/Swagger/SummitSchemas.php index b08338e0f..1ac3ebedf 100644 --- a/app/Swagger/SummitSchemas.php +++ b/app/Swagger/SummitSchemas.php @@ -361,10 +361,11 @@ class PaginatedSummitAttendeeBadgesResponseSchema {} new OA\Property(property: "temporary_links_public_storage_ttl", type: "integer", description: "TTL in seconds", nullable: true, example: 3600), new OA\Property(property: "private_storage_type", type: "string", example: "local"), new OA\Property(property: "public_storage_type", type: "string", example: "s3"), - new OA\Property(property: "type_id", type: "integer", example: 456), new OA\Property(property: "is_editable", type: "boolean", example: true), ], anyOf: [ + new OA\Property(property: "type_id", type: "integer", example: 456), + new OA\Property(property: "type", type: "SummitMediaFileType", description: "Only present when relations=presentation_types and expand includes 'type' in it."), new OA\Property(property: "summit_id", type: "integer", example: 123, description: "Summit ID, only when expand does NOT include 'summit' in it."), new OA\Property(property: "summit", type: "Summit", description: "Summit expand (only when relations=presentation_types) and expand includes 'summit' in it."), new OA\Property( From f26e5077bb0c23fbc70cf6209c562e581756b126 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 17:42:28 -0300 Subject: [PATCH 3/9] fix: param definition --- ...uth2SummitMediaUploadTypeApiController.php | 80 ++++++++++++++++--- 1 file changed, 70 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index d2c459bb7..65d535d32 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -72,9 +72,27 @@ public function __construct security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), - new OA\Parameter(ref: "#/components/parameters/page_number_param"), - new OA\Parameter(ref: "#/components/parameters/page_size_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), + new OA\Parameter( + name: 'page', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The page number' + ), + new OA\Parameter( + name: 'page_size', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The number of pages in each page', + ), new OA\Parameter( name: "filter[]", in: "query", @@ -132,7 +150,13 @@ public function getAllBySummit($summit_id) security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), new OA\Parameter( name: "media_upload_type_id", in: "path", @@ -178,7 +202,13 @@ public function get($summit_id, $media_upload_type_id) security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), ], requestBody: new OA\RequestBody( required: true, @@ -209,7 +239,13 @@ public function add($summit_id) security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), new OA\Parameter( name: "media_upload_type_id", in: "path", @@ -247,7 +283,13 @@ public function update($summit_id, $media_upload_type_id) security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), new OA\Parameter( name: "media_upload_type_id", in: "path", @@ -394,7 +436,13 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), new OA\Parameter( name: "media_upload_type_id", in: "path", @@ -451,7 +499,13 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), new OA\Parameter( name: "media_upload_type_id", in: "path", @@ -507,7 +561,13 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Media Upload Types"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The summit ID' + ), new OA\Parameter( name: "to_summit_id", in: "path", From 00a1bf3070badb7cbc78b433ef8439e5f9376333 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 18:38:12 -0300 Subject: [PATCH 4/9] fix: param definition --- .../Summit/OAuth2SummitMediaUploadTypeApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index 65d535d32..52506313c 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -87,11 +87,11 @@ public function __construct description: 'The page number' ), new OA\Parameter( - name: 'page_size', + name: 'per_page', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), - description: 'The number of pages in each page', + description: 'The number of items per page', ), new OA\Parameter( name: "filter[]", From f9353323b973aba4eb4822f8ee1554a6c2c45fb6 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 14 Oct 2025 14:53:40 -0300 Subject: [PATCH 5/9] fix: Change "namespace" word positioning --- .../Summit/OAuth2SummitMediaUploadTypeApiController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index 52506313c..fc3544ebf 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -1,4 +1,7 @@ - Date: Mon, 10 Nov 2025 22:09:57 +0000 Subject: [PATCH 6/9] fix: Add security schema --- ...uth2SummitMediaUploadTypeApiController.php | 175 +++++++++++++----- 1 file changed, 127 insertions(+), 48 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index fc3544ebf..e8a97746f 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -26,6 +26,28 @@ use ModelSerializers\SerializerRegistry; use OpenApi\Attributes as OA; + + +#[OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'OAuth2SummitMediaUploadTypeApiControllerSecurity', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], +) +] +class RSVPAuthSchema +{ +} + /** * Class OAuth2SummitMediaUploadTypeApiController * @package App\Http\Controllers @@ -58,10 +80,9 @@ public function __construct ( ISummitMediaUploadTypeRepository $repository, ISummitRepository $summit_repository, - ISummitMediaUploadTypeService $service, + ISummitMediaUploadTypeService $service, IResourceServerContext $resource_server_context - ) - { + ) { parent::__construct($resource_server_context); $this->service = $service; $this->summit_repository = $summit_repository; @@ -72,7 +93,13 @@ public function __construct path: "/api/v1/summits/{id}/media-upload-types", summary: "Get all media upload types for a summit", description: "Returns a paginated list of media upload types configured for a specific summit. Allows ordering, filtering and pagination.", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::ReadAllSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -142,7 +169,8 @@ public function getAllBySummit($summit_id) { $this->summit_id = $summit_id; $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($this->summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); return $this->getAll(); } @@ -150,7 +178,13 @@ public function getAllBySummit($summit_id) path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", summary: "Get a specific media upload type", description: "Returns detailed information about a specific media upload type", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::ReadAllSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -202,7 +236,13 @@ public function get($summit_id, $media_upload_type_id) path: "/api/v1/summits/{id}/media-upload-types", summary: "Create a new media upload type", description: "Creates a new media upload type for the specified summit", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -239,7 +279,13 @@ public function add($summit_id) path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", summary: "Update a media upload type", description: "Updates an existing media upload type", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -283,7 +329,13 @@ public function update($summit_id, $media_upload_type_id) path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", summary: "Delete a media upload type", description: "Deletes a media upload type from the summit", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -316,7 +368,7 @@ public function delete($summit_id, $media_upload_type_id) /** * @return array */ - protected function getFilterRules():array + protected function getFilterRules(): array { return [ 'name' => ['=@', '=='], @@ -326,7 +378,8 @@ protected function getFilterRules():array /** * @return array */ - protected function getFilterValidatorRules():array{ + protected function getFilterValidatorRules(): array + { return [ 'name' => 'sometimes|required|string', ]; @@ -334,7 +387,8 @@ protected function getFilterValidatorRules():array{ /** * @return array */ - protected function getOrderRules():array{ + protected function getOrderRules(): array + { return [ 'id', 'name', @@ -349,10 +403,10 @@ protected function addChild(Summit $summit, array $payload): IEntity // authz // check that we have a current member ( not service account ) $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) + if (is_null($current_member)) throw new HTTP401UnauthorizedException(); // check summit access - if(!$current_member->isSummitAllowed($summit)) + if (!$current_member->isSummitAllowed($summit)) throw new HTTP403ForbiddenException(); return $this->service->add($summit, $payload); } @@ -381,10 +435,10 @@ protected function deleteChild(Summit $summit, $child_id): void // authz // check that we have a current member ( not service account ) $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) + if (is_null($current_member)) throw new HTTP401UnauthorizedException(); // check summit access - if(!$current_member->isSummitAllowed($summit)) + if (!$current_member->isSummitAllowed($summit)) throw new HTTP403ForbiddenException(); $this->service->delete($summit, $child_id); @@ -398,13 +452,13 @@ protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity // authz // check that we have a current member ( not service account ) $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) + if (is_null($current_member)) throw new HTTP401UnauthorizedException(); // check summit access - if(!$current_member->isSummitAllowed($summit)) + if (!$current_member->isSummitAllowed($summit)) throw new HTTP403ForbiddenException(); - return $summit->getMediaUploadTypeById($child_id); + return $summit->getMediaUploadTypeById($child_id); } /** @@ -423,10 +477,10 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I // authz // check that we have a current member ( not service account ) $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) + if (is_null($current_member)) throw new HTTP401UnauthorizedException(); // check summit access - if(!$current_member->isSummitAllowed($summit)) + if (!$current_member->isSummitAllowed($summit)) throw new HTTP403ForbiddenException(); return $this->service->update($summit, $child_id, $payload); @@ -436,7 +490,13 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}", summary: "Add media upload type to presentation type", description: "Associates a media upload type with a specific presentation type", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -472,19 +532,21 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"), ] )] - public function addToPresentationType($summit_id, $media_upload_type_id, $presentation_type_id){ - return $this->processRequest(function() use($summit_id, $media_upload_type_id, $presentation_type_id){ + public function addToPresentationType($summit_id, $media_upload_type_id, $presentation_type_id) + { + return $this->processRequest(function () use ($summit_id, $media_upload_type_id, $presentation_type_id) { $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); - // authz - // check that we have a current member ( not service account ) - $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) - throw new HTTP401UnauthorizedException(); - // check summit access - if(!$current_member->isSummitAllowed($summit)) - throw new HTTP403ForbiddenException(); + // authz + // check that we have a current member ( not service account ) + $current_member = $this->getResourceServerContext()->getCurrentUser(); + if (is_null($current_member)) + throw new HTTP401UnauthorizedException(); + // check summit access + if (!$current_member->isSummitAllowed($summit)) + throw new HTTP403ForbiddenException(); $presentation_type = $this->service->addToPresentationType($summit, intval($media_upload_type_id), intval($presentation_type_id)); @@ -499,7 +561,13 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}", summary: "Remove media upload type from presentation type", description: "Removes the association between a media upload type and a presentation type", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -535,18 +603,20 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"), ] )] - public function deleteFromPresentationType($summit_id, $media_upload_type_id, $presentation_type_id){ - return $this->processRequest(function() use($summit_id, $media_upload_type_id, $presentation_type_id){ + public function deleteFromPresentationType($summit_id, $media_upload_type_id, $presentation_type_id) + { + return $this->processRequest(function () use ($summit_id, $media_upload_type_id, $presentation_type_id) { $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); // authz // check that we have a current member ( not service account ) $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) + if (is_null($current_member)) throw new HTTP401UnauthorizedException(); // check summit access - if(!$current_member->isSummitAllowed($summit)) + if (!$current_member->isSummitAllowed($summit)) throw new HTTP403ForbiddenException(); $presentation_type = $this->service->deleteFromPresentationType($summit, intval($media_upload_type_id), intval($presentation_type_id)); @@ -561,7 +631,13 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p path: "/api/v1/summits/{id}/media-upload-types/all/clone/{to_summit_id}", summary: "Clone media upload types to another summit", description: "Clones all media upload types from one summit to another summit", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -590,25 +666,28 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Source or target summit not found"), ] )] - public function cloneMediaUploadTypes($summit_id, $to_summit_id){ - return $this->processRequest(function() use($summit_id, $to_summit_id){ + public function cloneMediaUploadTypes($summit_id, $to_summit_id) + { + return $this->processRequest(function () use ($summit_id, $to_summit_id) { $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); $to_summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($to_summit_id); - if (is_null($to_summit)) return $this->error404(); + if (is_null($to_summit)) + return $this->error404(); // authz // check that we have a current member ( not service account ) $current_member = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_member)) + if (is_null($current_member)) throw new HTTP401UnauthorizedException(); // check summit access - if(!$current_member->isSummitAllowed($summit)) + if (!$current_member->isSummitAllowed($summit)) throw new HTTP403ForbiddenException(); // check summit access - if(!$current_member->isSummitAllowed($to_summit)) + if (!$current_member->isSummitAllowed($to_summit)) throw new HTTP403ForbiddenException(); $to_summit = $this->service->cloneMediaUploadTypes($summit, $to_summit); @@ -622,4 +701,4 @@ public function cloneMediaUploadTypes($summit_id, $to_summit_id){ }); } -} \ No newline at end of file +} From f0c38d0959b6be91ee7ead8d98827be22cf6efaf Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 21:37:39 +0000 Subject: [PATCH 7/9] chore: Move the security schema for the controller to its own file --- ...uth2SummitMediaUploadTypeApiController.php | 95 +++++++++++++------ .../SummitMediaUploadTypeOAuth2Scheme.php | 29 ++++++ 2 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 app/Swagger/Security/SummitMediaUploadTypeOAuth2Scheme.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index e8a97746f..a82b08718 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -16,7 +16,9 @@ **/ use HTTP401UnauthorizedException; use App\Http\Exceptions\HTTP403ForbiddenException; +use App\Models\Foundation\Main\IGroup; use App\Models\Foundation\Summit\Repositories\ISummitMediaUploadTypeRepository; +use App\Security\SummitScopes; use App\Services\Model\ISummitMediaUploadTypeService; use Illuminate\Http\Response; use models\oauth2\IResourceServerContext; @@ -27,27 +29,6 @@ use OpenApi\Attributes as OA; - -#[OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'OAuth2SummitMediaUploadTypeApiControllerSecurity', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - SummitScopes::ReadAllSummitData => 'Read All Summit Data', - SummitScopes::WriteSummitData => 'Write Summit Data', - ], - ), - ], -) -] -class RSVPAuthSchema -{ -} - /** * Class OAuth2SummitMediaUploadTypeApiController * @package App\Http\Controllers @@ -95,11 +76,18 @@ public function __construct description: "Returns a paginated list of media upload types configured for a specific summit. Allows ordering, filtering and pagination.", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::ReadAllSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -180,11 +168,18 @@ public function getAllBySummit($summit_id) description: "Returns detailed information about a specific media upload type", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::ReadAllSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -238,11 +233,18 @@ public function get($summit_id, $media_upload_type_id) description: "Creates a new media upload type for the specified summit", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::WriteSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -281,11 +283,18 @@ public function add($summit_id) description: "Updates an existing media upload type", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::WriteSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -331,11 +340,18 @@ public function update($summit_id, $media_upload_type_id) description: "Deletes a media upload type from the summit", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::WriteSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -492,11 +508,18 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I description: "Associates a media upload type with a specific presentation type", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::WriteSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -563,11 +586,18 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen description: "Removes the association between a media upload type and a presentation type", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::WriteSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( @@ -633,11 +663,18 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p description: "Clones all media upload types from one summit to another summit", security: [ [ - "OAuth2SummitMediaUploadTypeApiControllerSecurity" => [ + "summit_media_upload_type_oauth2" => [ SummitScopes::WriteSummitData, ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + ] + ], tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( diff --git a/app/Swagger/Security/SummitMediaUploadTypeOAuth2Scheme.php b/app/Swagger/Security/SummitMediaUploadTypeOAuth2Scheme.php new file mode 100644 index 000000000..74359427e --- /dev/null +++ b/app/Swagger/Security/SummitMediaUploadTypeOAuth2Scheme.php @@ -0,0 +1,29 @@ + 'Read All Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], +) +] +class SummitMediaUploadTypeOAuth2Scheme +{ +} From 241e778dd13f331d9a88cac767224a2e9a2435aa Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 3 Dec 2025 18:12:05 +0000 Subject: [PATCH 8/9] fix: add requested changes --- ...uth2SummitMediaUploadTypeApiController.php | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index a82b08718..6f944c8c7 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -72,6 +72,7 @@ public function __construct #[OA\Get( path: "/api/v1/summits/{id}/media-upload-types", + operationId: "getAllMediaUploadTypes", summary: "Get all media upload types for a summit", description: "Returns a paginated list of media upload types configured for a specific summit. Allows ordering, filtering and pagination.", security: [ @@ -91,7 +92,7 @@ public function __construct tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -164,6 +165,7 @@ public function getAllBySummit($summit_id) #[OA\Get( path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", + operationId: "getMediaUploadType", summary: "Get a specific media upload type", description: "Returns detailed information about a specific media upload type", security: [ @@ -183,7 +185,7 @@ public function getAllBySummit($summit_id) tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -229,6 +231,7 @@ public function get($summit_id, $media_upload_type_id) #[OA\Post( path: "/api/v1/summits/{id}/media-upload-types", + operationId: "createMediaUploadType", summary: "Create a new media upload type", description: "Creates a new media upload type for the specified summit", security: [ @@ -248,7 +251,7 @@ public function get($summit_id, $media_upload_type_id) tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -279,6 +282,7 @@ public function add($summit_id) #[OA\Put( path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", + operationId: "updateMediaUploadType", summary: "Update a media upload type", description: "Updates an existing media upload type", security: [ @@ -298,7 +302,7 @@ public function add($summit_id) tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -336,6 +340,7 @@ public function update($summit_id, $media_upload_type_id) #[OA\Delete( path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}", + operationId: "deleteMediaUploadType", summary: "Delete a media upload type", description: "Deletes a media upload type from the summit", security: [ @@ -355,7 +360,7 @@ public function update($summit_id, $media_upload_type_id) tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -504,6 +509,7 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I #[OA\Put( path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}", + operationId: "addMediaUploadTypeToPresentationType", summary: "Add media upload type to presentation type", description: "Associates a media upload type with a specific presentation type", security: [ @@ -523,7 +529,7 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -582,6 +588,7 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen #[OA\Delete( path: "/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}", + operationId: "removeMediaUploadTypeFromPresentationType", summary: "Remove media upload type from presentation type", description: "Removes the association between a media upload type and a presentation type", security: [ @@ -601,7 +608,7 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -659,6 +666,7 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p #[OA\Post( path: "/api/v1/summits/{id}/media-upload-types/all/clone/{to_summit_id}", + operationId: "cloneMediaUploadTypes", summary: "Clone media upload types to another summit", description: "Clones all media upload types from one summit to another summit", security: [ @@ -678,7 +686,7 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p tags: ["Summit Media Upload Types"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'query', required: false, schema: new OA\Schema(type: 'integer'), @@ -738,4 +746,4 @@ public function cloneMediaUploadTypes($summit_id, $to_summit_id) }); } -} +} \ No newline at end of file From cb17dada6e8ccacdceeb99fc81cca0c110186b2b Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 4 Dec 2025 18:41:18 +0000 Subject: [PATCH 9/9] feat: Add changes requested in PR --- ...uth2SummitMediaUploadTypeApiController.php | 18 +++--- .../Models/SummitMediaFileTypeSchema.php | 26 ++++++++ .../Models/SummitMediaUploadTypeSchema.php | 42 +++++++++++++ app/Swagger/SummitSchemas.php | 62 ------------------- 4 files changed, 77 insertions(+), 71 deletions(-) create mode 100644 app/Swagger/Models/SummitMediaFileTypeSchema.php create mode 100644 app/Swagger/Models/SummitMediaUploadTypeSchema.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php index 6f944c8c7..0bcc52159 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php @@ -93,7 +93,7 @@ public function __construct parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -186,7 +186,7 @@ public function getAllBySummit($summit_id) parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -252,7 +252,7 @@ public function get($summit_id, $media_upload_type_id) parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -303,7 +303,7 @@ public function add($summit_id) parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -361,7 +361,7 @@ public function update($summit_id, $media_upload_type_id) parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -530,7 +530,7 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -609,7 +609,7 @@ public function addToPresentationType($summit_id, $media_upload_type_id, $presen parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -687,7 +687,7 @@ public function deleteFromPresentationType($summit_id, $media_upload_type_id, $p parameters: [ new OA\Parameter( name: 'id', - in: 'query', + in: 'path', required: false, schema: new OA\Schema(type: 'integer'), description: 'The summit ID' @@ -746,4 +746,4 @@ public function cloneMediaUploadTypes($summit_id, $to_summit_id) }); } -} \ No newline at end of file +} diff --git a/app/Swagger/Models/SummitMediaFileTypeSchema.php b/app/Swagger/Models/SummitMediaFileTypeSchema.php new file mode 100644 index 000000000..8e230a9e0 --- /dev/null +++ b/app/Swagger/Models/SummitMediaFileTypeSchema.php @@ -0,0 +1,26 @@ +