From ab0600605c84ba4b565eae095d6b0703485a2806 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 2 Oct 2025 13:02:08 -0300 Subject: [PATCH 1/8] feat: Extend Swagger Coverage for controller Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php - fix: Typo seet_type should be seat_type in RSVPAdminAddRequest schema --- ...th2SummitBadgeFeatureTypeApiController.php | 314 +++++++++++++++++- app/Swagger/schemas.php | 2 +- 2 files changed, 314 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index e2bfadae7..74fced109 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -12,6 +12,7 @@ * limitations under the License. **/ use App\Models\Foundation\Summit\Repositories\ISummitBadgeFeatureTypeRepository; +use App\Security\SummitScopes; use App\Services\Model\ISummitBadgeFeatureTypeService; use Illuminate\Http\Request as LaravelRequest; use Illuminate\Support\Facades\Log; @@ -23,6 +24,7 @@ use models\utils\IBaseRepository; use models\utils\IEntity; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; use Exception; /** * Class OAuth2SummitBadgeFeatureTypeApiController @@ -63,6 +65,316 @@ public function __construct $this->service = $service; } + // OpenAPI Documentation + + #[OA\Get( + path: '/api/v1/summits/{id}/badge-feature-types', + summary: 'Get all badge feature types for a summit', + description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).', + security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + 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@@speaker') + ) + ), + 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: 'Badge feature types retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/PaginatedSummitBadgeFeatureTypesResponse') + ), + 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\Get( + path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', + summary: 'Get a badge feature type by ID', + description: 'Retrieves detailed information about a specific badge feature type.', + security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'feature_id', + in: 'path', + required: true, + description: 'Badge Feature Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Badge feature type retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType') + ), + 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/summits/{id}/badge-feature-types', + summary: 'Create a new badge feature type', + description: 'Creates a new badge feature type for the summit.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureTypeCreateRequest') + ), + responses: [ + new OA\Response( + response: 201, + description: 'Badge feature type created successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType') + ), + 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\Put( + path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', + summary: 'Update a badge feature type', + description: 'Updates an existing badge feature type.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'feature_id', + in: 'path', + required: true, + description: 'Badge Feature Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureTypeUpdateRequest') + ), + responses: [ + new OA\Response( + response: 200, + description: 'Badge feature type updated successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType') + ), + 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/summits/{id}/badge-feature-types/{feature_id}', + summary: 'Delete a badge feature type', + description: 'Deletes an existing badge feature type from the summit.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'feature_id', + in: 'path', + required: true, + description: 'Badge Feature Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + responses: [ + new OA\Response( + response: 204, + description: 'Badge feature 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'), + ] + )] + + #[OA\Post( + path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', + summary: 'Add an image to a badge feature type', + description: 'Uploads and associates an image file with a badge feature type. This image is typically displayed on attendee badges.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'feature_id', + in: 'path', + required: true, + description: 'Badge Feature Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: 'multipart/form-data', + schema: new OA\Schema( + required: ['file'], + properties: [ + new OA\Property( + property: 'file', + type: 'string', + format: 'binary', + description: 'Image file to upload' + ) + ] + ) + ) + ), + responses: [ + new OA\Response( + response: 201, + description: 'Image uploaded successfully', + content: new OA\JsonContent( + type: 'object', + properties: [ + new OA\Property(property: 'id', type: 'integer', example: 1), + new OA\Property(property: 'url', type: 'string', example: 'https://example.com/images/badge-feature.png'), + ] + ) + ), + 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\Delete( + path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', + summary: 'Delete the image from a badge feature type', + description: 'Removes the associated image from a badge feature type.', + security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + tags: ['Badge Feature Types'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'feature_id', + in: 'path', + required: true, + description: 'Badge Feature Type ID', + schema: new OA\Schema(type: 'integer') + ), + ], + responses: [ + new OA\Response( + response: 204, + description: 'Image 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'), + ] + )] /** * @return array @@ -249,4 +561,4 @@ public function deleteFeatureImage($summit_id, $feature_id) { return $this->error500($ex); } } -} \ No newline at end of file +} diff --git a/app/Swagger/schemas.php b/app/Swagger/schemas.php index 1eff77226..b1e2f5134 100644 --- a/app/Swagger/schemas.php +++ b/app/Swagger/schemas.php @@ -346,7 +346,7 @@ class RSVPUpdateRequestSchema_{ type: 'object', properties: [ new OA\Property(property: 'attendee_id', type: 'integer', example: 123), - new OA\Property(property: 'seet_type', type: 'string', example: RSVP::SeatTypeRegular), + new OA\Property(property: 'seat_type', type: 'string', example: RSVP::SeatTypeRegular), ] )] From 6867157af1b767155aa071e31d24a4f6491c3151 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 14 Oct 2025 14:24:29 -0300 Subject: [PATCH 2/8] fix: Move schema to the new file --- ...th2SummitBadgeFeatureTypeApiController.php | 7 ++- app/Swagger/SummitRegistrationSchemas.php | 57 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index 74fced109..09ee8bcdc 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -1,4 +1,7 @@ -error500($ex); } } -} +} \ No newline at end of file diff --git a/app/Swagger/SummitRegistrationSchemas.php b/app/Swagger/SummitRegistrationSchemas.php index 6b3e2f895..80812cf41 100644 --- a/app/Swagger/SummitRegistrationSchemas.php +++ b/app/Swagger/SummitRegistrationSchemas.php @@ -5,3 +5,60 @@ use OpenApi\Attributes as OA; // + +// Summit Badge Feature Types + +#[OA\Schema( + schema: 'SummitBadgeFeatureType', + type: 'object', + properties: [ + new OA\Property(property: 'id', type: 'integer', example: 1), + new OA\Property(property: 'name', type: 'string', example: 'Speaker Ribbon'), + new OA\Property(property: 'description', type: 'string', nullable: true, example: 'Special ribbon indicating speaker status'), + new OA\Property(property: 'template_content', type: 'string', nullable: true, example: '
{{name}}
'), + new OA\Property(property: 'summit_id', type: 'integer', example: 42), + new OA\Property(property: 'image', type: 'string', nullable: true, example: 'https://example.com/images/speaker-ribbon.png'), + ] +)] +class SummitBadgeFeatureTypeSchema {} + +#[OA\Schema( + schema: 'PaginatedSummitBadgeFeatureTypesResponse', + allOf: [ + new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'), + new OA\Schema( + type: 'object', + properties: [ + new OA\Property( + property: 'data', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/SummitBadgeFeatureType') + ) + ] + ) + ] +)] +class PaginatedSummitBadgeFeatureTypesResponseSchema {} + +#[OA\Schema( + schema: 'SummitBadgeFeatureTypeCreateRequest', + type: 'object', + required: ['name'], + properties: [ + new OA\Property(property: 'name', type: 'string', example: 'Speaker Ribbon'), + new OA\Property(property: 'description', type: 'string', nullable: true, example: 'Special ribbon for speakers'), + new OA\Property(property: 'template_content', type: 'string', nullable: true, example: '
{{name}}
'), + ] +)] +class SummitBadgeFeatureTypeCreateRequestSchema {} + +#[OA\Schema( + schema: 'SummitBadgeFeatureTypeUpdateRequest', + type: 'object', + properties: [ + new OA\Property(property: 'name', type: 'string', example: 'VIP Ribbon'), + new OA\Property(property: 'description', type: 'string', nullable: true, example: 'VIP attendee designation'), + new OA\Property(property: 'template_content', type: 'string', nullable: true, example: '
{{name}}
'), + ] +)] +class SummitBadgeFeatureTypeUpdateRequestSchema {} From 148596a918c6c799265cadd0cb0b642004060f00 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 31 Oct 2025 15:37:18 -0300 Subject: [PATCH 3/8] fix: add the right security schema --- .../Summit/OAuth2SummitBadgeFeatureTypeApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index 09ee8bcdc..cc7d7ca5a 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -74,7 +74,7 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types', summary: 'Get all badge feature types for a summit', description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).', - security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + security: [['Bearer' => [SummitScopes::ReadAllSummitData]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -564,4 +564,4 @@ public function deleteFeatureImage($summit_id, $feature_id) { return $this->error500($ex); } } -} \ No newline at end of file +} From e77db3bd9351d81cdd257db1042c4c7a40ea46b3 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 7 Nov 2025 21:56:33 +0000 Subject: [PATCH 4/8] fix: security scopes --- .../OAuth2SummitBadgeFeatureTypeApiController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index cc7d7ca5a..344a125c3 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -74,7 +74,10 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types', summary: 'Get all badge feature types for a summit', description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).', - security: [['Bearer' => [SummitScopes::ReadAllSummitData]]], + security: [['oauth2_security_scope' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -137,7 +140,10 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', summary: 'Get a badge feature type by ID', description: 'Retrieves detailed information about a specific badge feature type.', - security: [['oauth2_security_scope' => [SummitScopes::ReadAllSummitData]]], + security: [['oauth2_security_scope' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( From 8f63195ea4e648eebad3c5bd3e6848c18e4bb72a Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 12 Nov 2025 15:32:31 +0000 Subject: [PATCH 5/8] fix: Incorrect responses --- ...th2SummitBadgeFeatureTypeApiController.php | 122 +++++++++++------- 1 file changed, 76 insertions(+), 46 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index 344a125c3..6eea4ed9a 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -15,9 +15,11 @@ * limitations under the License. **/ use App\Models\Foundation\Summit\Repositories\ISummitBadgeFeatureTypeRepository; +use App\Models\Foundation\Main\IGroup; use App\Security\SummitScopes; use App\Services\Model\ISummitBadgeFeatureTypeService; use Illuminate\Http\Request as LaravelRequest; +use Illuminate\Http\Response; use Illuminate\Support\Facades\Log; use models\exceptions\EntityNotFoundException; use models\exceptions\ValidationException; @@ -29,6 +31,27 @@ use ModelSerializers\SerializerRegistry; use OpenApi\Attributes as OA; use Exception; + + +#[OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'badge_feature_types_oauth2', + 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::ReadSummitData => 'Read Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], + ) +] +class BadgeFeatureTypesOauth2Schema{} + /** * Class OAuth2SummitBadgeFeatureTypeApiController * @package App\Http\Controllers @@ -74,7 +97,14 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types', summary: 'Get all badge feature types for a summit', description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).', - security: [['oauth2_security_scope' => [ + x: [ + 'required-groups' => [ + IGroup::SummitAdministrators, + IGroup::SuperAdmins, + IGroup::Administrators + ] + ], + security: [['badge_feature_types_oauth2' => [ SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData, ]]], @@ -127,12 +157,12 @@ public function __construct description: 'Badge feature types retrieved successfully', content: new OA\JsonContent(ref: '#/components/schemas/PaginatedSummitBadgeFeatureTypesResponse') ), - 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"), ] )] @@ -144,7 +174,7 @@ public function __construct SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData, ]]], - tags: ['Badge Feature Types'], + tags: ['Badges Feature Types'], parameters: [ new OA\Parameter( name: 'id', @@ -167,12 +197,12 @@ public function __construct description: 'Badge feature type retrieved successfully', content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType') ), - 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"), ] )] @@ -201,13 +231,13 @@ public function __construct description: 'Badge feature type created successfully', content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType') ), - 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_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: "Unprocessable Entity"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -243,13 +273,13 @@ public function __construct description: 'Badge feature type updated successfully', content: new OA\JsonContent(ref: '#/components/schemas/SummitBadgeFeatureType') ), - 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_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: "Unprocessable Entity"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -280,12 +310,12 @@ public function __construct response: 204, description: 'Badge feature 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_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] @@ -340,12 +370,12 @@ public function __construct ] ) ), - 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"), ] )] @@ -376,12 +406,12 @@ public function __construct response: 204, description: 'Image 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_INTERNAL_SERVER_ERROR, description: "Server Error"), ] )] From a8095ac7d02ff475ff9d5d8083fec4b5cda328d2 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 12 Nov 2025 15:41:46 +0000 Subject: [PATCH 6/8] fix: Add security schema --- ...th2SummitBadgeFeatureTypeApiController.php | 77 ++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index 6eea4ed9a..1f1be6f65 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -99,9 +99,10 @@ public function __construct description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).', x: [ 'required-groups' => [ - IGroup::SummitAdministrators, IGroup::SuperAdmins, - IGroup::Administrators + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, ] ], security: [['badge_feature_types_oauth2' => [ @@ -170,11 +171,19 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', summary: 'Get a badge feature type by ID', description: 'Retrieves detailed information about a specific badge feature type.', - security: [['oauth2_security_scope' => [ + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], + security: [['badge_feature_types_oauth2' => [ SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData, ]]], - tags: ['Badges Feature Types'], + tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( name: 'id', @@ -210,7 +219,17 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types', summary: 'Create a new badge feature type', description: 'Creates a new badge feature type for the summit.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], + security: [['badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -245,7 +264,17 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', summary: 'Update a badge feature type', description: 'Updates an existing badge feature type.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], + security: [['badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -287,7 +316,17 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', summary: 'Delete a badge feature type', description: 'Deletes an existing badge feature type from the summit.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], + security: [['badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -323,7 +362,17 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', summary: 'Add an image to a badge feature type', description: 'Uploads and associates an image file with a badge feature type. This image is typically displayed on attendee badges.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], + security: [['badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -383,7 +432,17 @@ public function __construct path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', summary: 'Delete the image from a badge feature type', description: 'Removes the associated image from a badge feature type.', - security: [['oauth2_security_scope' => [SummitScopes::WriteSummitData]]], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], + security: [['badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ]]], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( From ebd95c402df016c612b605c2fdf9abe90efc0c69 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 19:51:38 +0000 Subject: [PATCH 7/8] chore: Move the security schema for the controller to its own file --- ...th2SummitBadgeFeatureTypeApiController.php | 19 -------------- .../BadgeFeatureTypesOauth2Schema.php | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 app/Swagger/Security/BadgeFeatureTypesOauth2Schema.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index 1f1be6f65..9ac139168 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -33,25 +33,6 @@ use Exception; -#[OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'badge_feature_types_oauth2', - 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::ReadSummitData => 'Read Summit Data', - SummitScopes::WriteSummitData => 'Write Summit Data', - ], - ), - ], - ) -] -class BadgeFeatureTypesOauth2Schema{} - /** * Class OAuth2SummitBadgeFeatureTypeApiController * @package App\Http\Controllers diff --git a/app/Swagger/Security/BadgeFeatureTypesOauth2Schema.php b/app/Swagger/Security/BadgeFeatureTypesOauth2Schema.php new file mode 100644 index 000000000..1ee782e02 --- /dev/null +++ b/app/Swagger/Security/BadgeFeatureTypesOauth2Schema.php @@ -0,0 +1,25 @@ + 'Read All Summit Data', + SummitScopes::ReadSummitData => 'Read Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], + ) +] +class BadgeFeatureTypesOauth2Schema{} From 9355740e0511f2603abcf4d74838bf2453679088 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 21 Nov 2025 19:05:40 +0000 Subject: [PATCH 8/8] chore: include PR requested changes --- ...th2SummitBadgeFeatureTypeApiController.php | 146 +++++++++++------- 1 file changed, 87 insertions(+), 59 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php index 9ac139168..8d0c8ee5c 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php @@ -37,9 +37,7 @@ * Class OAuth2SummitBadgeFeatureTypeApiController * @package App\Http\Controllers */ -final class OAuth2SummitBadgeFeatureTypeApiController - extends OAuth2ProtectedController - +final class OAuth2SummitBadgeFeatureTypeApiController extends OAuth2ProtectedController { /** * @var ISummitRepository @@ -64,8 +62,7 @@ public function __construct ISummitRepository $summit_repository, ISummitBadgeFeatureTypeService $service, IResourceServerContext $resource_server_context - ) - { + ) { parent::__construct($resource_server_context); $this->repository = $repository; $this->summit_repository = $summit_repository; @@ -76,6 +73,7 @@ public function __construct #[OA\Get( path: '/api/v1/summits/{id}/badge-feature-types', + operationId: 'getAllBadgeFeatureTypes', summary: 'Get all badge feature types for a summit', description: 'Retrieves a paginated list of badge feature types for a specific summit. Badge feature types define visual elements and features that can be applied to attendee badges (e.g., speaker ribbons, sponsor logos, special access indicators).', x: [ @@ -86,10 +84,14 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::ReadSummitData, - SummitScopes::ReadAllSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -150,6 +152,7 @@ public function __construct #[OA\Get( path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', + operationId: 'getBadgeFeatureType', summary: 'Get a badge feature type by ID', description: 'Retrieves detailed information about a specific badge feature type.', x: [ @@ -160,10 +163,14 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::ReadSummitData, - SummitScopes::ReadAllSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -198,6 +205,7 @@ public function __construct #[OA\Post( path: '/api/v1/summits/{id}/badge-feature-types', + operationId: 'createBadgeFeatureType', summary: 'Create a new badge feature type', description: 'Creates a new badge feature type for the summit.', x: [ @@ -208,9 +216,13 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -243,6 +255,7 @@ public function __construct #[OA\Put( path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', + operationId: 'updateBadgeFeatureType', summary: 'Update a badge feature type', description: 'Updates an existing badge feature type.', x: [ @@ -253,9 +266,13 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -295,6 +312,7 @@ public function __construct #[OA\Delete( path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}', + operationId: 'deleteBadgeFeatureType', summary: 'Delete a badge feature type', description: 'Deletes an existing badge feature type from the summit.', x: [ @@ -305,9 +323,13 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -341,6 +363,7 @@ public function __construct #[OA\Post( path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', + operationId: 'addBadgeFeatureTypeImage', summary: 'Add an image to a badge feature type', description: 'Uploads and associates an image file with a badge feature type. This image is typically displayed on attendee badges.', x: [ @@ -351,9 +374,13 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -411,6 +438,7 @@ public function __construct #[OA\Delete( path: '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', + operationId: 'deleteBadgeFeatureTypeImage', summary: 'Delete the image from a badge feature type', description: 'Removes the associated image from a badge feature type.', x: [ @@ -421,9 +449,13 @@ public function __construct IGroup::SummitRegistrationAdmins, ] ], - security: [['badge_feature_types_oauth2' => [ - SummitScopes::WriteSummitData, - ]]], + security: [ + [ + 'badge_feature_types_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], tags: ['Badge Feature Types'], parameters: [ new OA\Parameter( @@ -458,7 +490,7 @@ public function __construct /** * @return array */ - protected function getFilterRules():array + protected function getFilterRules(): array { return [ 'name' => ['=@', '=='], @@ -468,7 +500,8 @@ protected function getFilterRules():array /** * @return array */ - protected function getFilterValidatorRules():array{ + protected function getFilterValidatorRules(): array + { return [ 'name' => 'sometimes|required|string', ]; @@ -476,7 +509,8 @@ protected function getFilterValidatorRules():array{ /** * @return array */ - protected function getOrderRules():array{ + protected function getOrderRules(): array + { return [ 'id', 'name', @@ -499,7 +533,7 @@ protected function getOrderRules():array{ */ function getAddValidationRules(array $payload): array { - return SummitBadgeFeatureTypeValidationRulesFactory::build($payload); + return SummitBadgeFeatureTypeValidationRulesFactory::build($payload); } /** @@ -517,7 +551,7 @@ protected function addChild(Summit $summit, array $payload): IEntity */ protected function getSummitRepository(): ISummitRepository { - return $this->summit_repository; + return $this->summit_repository; } /** @@ -543,7 +577,7 @@ protected function getRepository(): IBaseRepository */ protected function deleteChild(Summit $summit, $child_id): void { - $this->service->deleteBadgeFeatureType($summit, $child_id); + $this->service->deleteBadgeFeatureType($summit, $child_id); } /** @@ -551,9 +585,9 @@ protected function deleteChild(Summit $summit, $child_id): void * @param $child_id * @return IEntity|null */ - protected function getChildFromSummit(Summit $summit,$child_id): ?IEntity + protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity { - return $summit->getFeatureTypeById($child_id); + return $summit->getFeatureTypeById($child_id); } /** @@ -582,10 +616,12 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I * @param $feature_id * @return \Illuminate\Http\JsonResponse|mixed */ - public function addFeatureImage(LaravelRequest $request, $summit_id, $feature_id){ + public function addFeatureImage(LaravelRequest $request, $summit_id, $feature_id) + { try { $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); $file = $request->file('file'); if (is_null($file)) { @@ -596,18 +632,13 @@ public function addFeatureImage(LaravelRequest $request, $summit_id, $feature_id return $this->created(SerializerRegistry::getInstance()->getSerializer($image)->serialize()); - } - catch (ValidationException $ex1) - { + } catch (ValidationException $ex1) { Log::warning($ex1); return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { + } catch (EntityNotFoundException $ex2) { Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { + return $this->error404(array('message' => $ex2->getMessage())); + } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } @@ -618,26 +649,23 @@ public function addFeatureImage(LaravelRequest $request, $summit_id, $feature_id * @param $feature_id * @return \Illuminate\Http\JsonResponse|mixed */ - public function deleteFeatureImage($summit_id, $feature_id) { + public function deleteFeatureImage($summit_id, $feature_id) + { try { $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); $this->service->removeFeatureImage($summit, $feature_id); return $this->deleted(); - } - catch (ValidationException $ex1) - { + } catch (ValidationException $ex1) { Log::warning($ex1); return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { + } catch (EntityNotFoundException $ex2) { Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { + return $this->error404(array('message' => $ex2->getMessage())); + } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } -} +} \ No newline at end of file