From d205b2e6d64102a3dfc40af9724000b14fac7fbc Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Wed, 15 Oct 2025 12:02:51 -0300 Subject: [PATCH] feat: Extend Swagger Coverage for controller `OAuth2SummitSpeakersAssistanceApiController` --- ...2SummitSpeakersAssistanceApiController.php | 253 +++++++++++++++++- app/Swagger/SummitPresentationSchemas.php | 77 ++++++ 2 files changed, 328 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php index 70891f0e3..861e84454 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php @@ -1,4 +1,6 @@ - []]], + tags: ["summit-speakers-assistances"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + 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", default: 1), + description: "Page number" + ), + new OA\Parameter( + name: "per_page", + in: "query", + required: false, + schema: new OA\Schema(type: "integer", default: 10), + description: "Items per page" + ), + new OA\Parameter( + name: "filter", + in: "query", + description: "Filter query. Available operators: id==, on_site_phone==/=@, speaker_email==/=@, speaker==/=@, is_confirmed==, registered==, confirmation_date>/=/<= (epoch)", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "order", + in: "query", + description: "Order by field. Available fields: id, is_confirmed, confirmation_date, created, registered", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "expand", + in: "query", + description: "Comma-separated list of relations to expand. Available: speaker", + schema: new OA\Schema(type: "string") + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedPresentationSpeakerSummitAssistanceConfirmationRequestsResponse") + ), + 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") + ] + )] public function getBySummit($summit_id) { try { @@ -162,6 +225,45 @@ public function getBySummit($summit_id) * @param $summit_id * @return mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/speakers-assistances/csv", + summary: "Export speaker assistances to CSV", + security: [["Bearer" => []]], + tags: ["summit-speakers-assistances"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "filter", + in: "query", + description: "Filter query. Available operators: id==, on_site_phone==/=@, speaker_email==/=@, speaker==/=@, is_confirmed==, registered==, confirmation_date>/=/<= (epoch)", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "order", + in: "query", + description: "Order by field. Available fields: id, is_confirmed, confirmation_date, created, registered", + schema: new OA\Schema(type: "string") + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\MediaType(mediaType: "text/csv", schema: new OA\Schema(type: "string")) + ), + 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") + ] + )] public function getBySummitCSV($summit_id){ try { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); @@ -236,6 +338,41 @@ public function getBySummitCSV($summit_id){ * @param $summit_id * @return mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/speakers-assistances", + summary: "Create a speaker assistance confirmation request", + security: [["Bearer" => []]], + tags: ["summit-speakers-assistances"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequestCreateRequest") + ) + ), + responses: [ + new OA\Response( + response: 201, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest") + ), + 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") + ] + )] public function addSpeakerSummitAssistance($summit_id) { try { @@ -288,6 +425,48 @@ public function addSpeakerSummitAssistance($summit_id) * @param $assistance_id * @return mixed */ + #[OA\Put( + path: "/api/v1/summits/{id}/speakers-assistances/{assistance_id}", + summary: "Update a speaker assistance confirmation request", + security: [["Bearer" => []]], + tags: ["summit-speakers-assistances"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "assistance_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The assistance id" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequestUpdateRequest") + ) + ), + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest") + ), + 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") + ] + )] public function updateSpeakerSummitAssistance($summit_id, $assistance_id) { try { @@ -340,6 +519,36 @@ public function updateSpeakerSummitAssistance($summit_id, $assistance_id) * @param $assistance_id * @return mixed */ + #[OA\Delete( + path: "/api/v1/summits/{id}/speakers-assistances/{assistance_id}", + summary: "Delete a speaker assistance confirmation request", + security: [["Bearer" => []]], + tags: ["summit-speakers-assistances"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "assistance_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The assistance id" + ) + ], + responses: [ + new OA\Response(response: 204, description: "No Content"), + 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") + ] + )] public function deleteSpeakerSummitAssistance($summit_id, $assistance_id) { try { @@ -368,6 +577,46 @@ public function deleteSpeakerSummitAssistance($summit_id, $assistance_id) * @param $assistance_id * @return mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/speakers-assistances/{assistance_id}", + summary: "Get a speaker assistance confirmation request by id", + security: [["Bearer" => []]], + tags: ["summit-speakers-assistances"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "assistance_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The assistance id" + ), + new OA\Parameter( + name: "expand", + in: "query", + description: "Comma-separated list of relations to expand. Available: speaker", + schema: new OA\Schema(type: "string") + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest") + ), + 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") + ] + )] public function getSpeakerSummitAssistanceBySummit($summit_id, $assistance_id) { try { @@ -398,4 +647,4 @@ public function getSpeakerSummitAssistanceBySummit($summit_id, $assistance_id) } } -} \ No newline at end of file +} diff --git a/app/Swagger/SummitPresentationSchemas.php b/app/Swagger/SummitPresentationSchemas.php index 6b3e2f895..228f026f4 100644 --- a/app/Swagger/SummitPresentationSchemas.php +++ b/app/Swagger/SummitPresentationSchemas.php @@ -4,4 +4,81 @@ use OpenApi\Attributes as OA; +// Summit Speaker Assistance Schemas + +#[OA\Schema( + schema: "PresentationSpeakerSummitAssistanceConfirmationRequest", + type: "object", + properties: [ + new OA\Property(property: "id", type: "integer", example: 1), + new OA\Property(property: "created", type: "integer", description: "Unix timestamp", example: 1640995200), + new OA\Property(property: "last_edited", type: "integer", description: "Unix timestamp", example: 1640995200), + new OA\Property(property: "on_site_phone", type: "string", nullable: true), + new OA\Property(property: "registered", type: "boolean"), + new OA\Property(property: "is_confirmed", type: "boolean"), + new OA\Property(property: "checked_in", type: "boolean"), + new OA\Property(property: "summit_id", type: "integer"), + new OA\Property(property: "speaker_email", type: "string"), + new OA\Property(property: "speaker_full_name", type: "string"), + new OA\Property(property: "confirmation_date", type: "integer", nullable: true), + ], + anyOf:[ + new OA\Property(property: "speaker_id", type: "integer"), + new OA\Property(property: "speaker", type: "PresentationSpeaker"), + ] +)] +class PresentationSpeakerSummitAssistanceConfirmationRequest +{ +} + +#[OA\Schema( + schema: "PaginatedPresentationSpeakerSummitAssistanceConfirmationRequestsResponse", + allOf: [ + new OA\Schema(ref: "#/components/schemas/PaginateDataSchemaResponse"), + new OA\Schema( + properties: [ + new OA\Property( + property: "data", + type: "array", + items: new OA\Items(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest") + ) + ] + ) + ] +)] +class PaginatedPresentationSpeakerSummitAssistanceConfirmationRequestsResponse +{ +} + +#[OA\Schema( + schema: "PresentationSpeakerSummitAssistanceConfirmationRequestCreateRequest", + type: "object", + required: ["speaker_id"], + properties: [ + new OA\Property(property: "speaker_id", type: "integer"), + new OA\Property(property: "on_site_phone", type: "string", maxLength: 50), + new OA\Property(property: "registered", type: "boolean"), + new OA\Property(property: "is_confirmed", type: "boolean"), + new OA\Property(property: "checked_in", type: "boolean") + ] +)] +class PresentationSpeakerSummitAssistanceConfirmationRequestCreateRequest +{ +} + +#[OA\Schema( + schema: "PresentationSpeakerSummitAssistanceConfirmationRequestUpdateRequest", + type: "object", + properties: [ + new OA\Property(property: "on_site_phone", type: "string", maxLength: 50), + new OA\Property(property: "registered", type: "boolean"), + new OA\Property(property: "is_confirmed", type: "boolean"), + new OA\Property(property: "checked_in", type: "boolean") + ] +)] +class PresentationSpeakerSummitAssistanceConfirmationRequestUpdateRequest +{ +} + // +