From 6182920fce40df25749bc89a7d5028311598ca21 Mon Sep 17 00:00:00 2001 From: Jose Andres Tejerina Date: Wed, 22 Oct 2025 15:32:35 -0300 Subject: [PATCH 1/6] feat: Extend Swagger Coverage for controller OAuth2SummitOrderExtraQuestionTypeApiController --- ...mitOrderExtraQuestionTypeApiController.php | 506 ++++++++++++++++++ .../SummitOrderExtraQuestionTypeSchemas.php | 74 +++ app/Swagger/schemas.php | 50 ++ 3 files changed, 630 insertions(+) create mode 100644 app/Swagger/SummitOrderExtraQuestionTypeSchemas.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php index d61ab06ff..f08df7cae 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php @@ -28,6 +28,8 @@ use models\summit\SummitOrderExtraQuestionTypeConstants; use models\utils\IEntity; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; +use Symfony\Component\HttpFoundation\Response; use utils\Filter; use utils\FilterElement; use utils\PagingInfo; @@ -37,6 +39,7 @@ * Class OAuth2SummitOrderExtraQuestionTypeApiController * @package App\Http\Controllers */ +#[OA\Tag(name: "Order Extra Questions", description: "Summit Order Extra Questions Management")] final class OAuth2SummitOrderExtraQuestionTypeApiController extends OAuth2ProtectedController { @@ -92,6 +95,29 @@ public function __construct * @param $summit_id * @return mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/order-extra-questions/metadata", + operationId: "getOrderExtraQuestionsMetadata", + description: "Get metadata for order extra questions", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Metadata retrieved successfully", + content: new OA\JsonContent(type: "object") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), + ] + )] public function getMetadata($summit_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); @@ -164,6 +190,37 @@ function getAddValidationRules(array $payload): array * @throws EntityNotFoundException * @throws ValidationException */ + #[OA\Post( + path: "/api/v1/summits/{id}/order-extra-questions", + operationId: "addOrderExtraQuestion", + description: "Add a new order extra question", + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") + ), + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: "Order extra question created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") + ), + 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"), + ] + )] protected function addChild(Summit $summit, array $payload): IEntity { return $this->service->addOrderExtraQuestion($summit, HTMLCleaner::cleanData($payload, ['label'])); @@ -183,6 +240,34 @@ protected function getSummitRepository(): ISummitRepository * @throws EntityNotFoundException * @throws ValidationException */ + #[OA\Delete( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}", + operationId: "deleteOrderExtraQuestion", + description: "Delete an order extra question", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response(response: Response::HTTP_NO_CONTENT, description: "Question 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: "Question or Summit not found"), + ] + )] protected function deleteChild(Summit $summit, $child_id): void { $this->service->deleteOrderExtraQuestion($summit, $child_id); @@ -210,6 +295,44 @@ function getUpdateValidationRules(array $payload): array * @throws \models\exceptions\EntityNotFoundException * @throws \models\exceptions\ValidationException */ + #[OA\Put( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}", + operationId: "updateOrderExtraQuestion", + description: "Update an order extra question", + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") + ), + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Question updated successfully", + content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") + ), + 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: "Question or Summit not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + ] + )] protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity { return $this->service->updateOrderExtraQuestion @@ -224,6 +347,44 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I * @param $question_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/values", + operationId: "addOrderExtraQuestionValue", + description: "Add a value to an order extra question", + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/ExtraQuestionTypeValue") + ), + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: "Value created successfully", + content: new OA\JsonContent(ref: "#/components/schemas/ExtraQuestionTypeValue") + ), + 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: "Question or Summit not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + ] + )] public function addQuestionValue($summit_id, $question_id) { return $this->processRequest(function () use ($summit_id, $question_id) { @@ -251,6 +412,51 @@ public function addQuestionValue($summit_id, $question_id) * @param $value_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Put( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/values/{value_id}", + operationId: "updateOrderExtraQuestionValue", + description: "Update a value of an order extra question", + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/ExtraQuestionTypeValue") + ), + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "value_id", + description: "Value ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Value updated successfully", + content: new OA\JsonContent(ref: "#/components/schemas/ExtraQuestionTypeValue") + ), + 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: "Value, Question or Summit not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + ] + )] public function updateQuestionValue($summit_id, $question_id, $value_id) { return $this->processRequest(function () use ($summit_id, $question_id, $value_id) { @@ -276,6 +482,41 @@ public function updateQuestionValue($summit_id, $question_id, $value_id) * @param $value_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Delete( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/values/{value_id}", + operationId: "deleteOrderExtraQuestionValue", + description: "Delete a value from an order extra question", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "value_id", + description: "Value ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response(response: Response::HTTP_NO_CONTENT, description: "Value 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: "Value, Question or Summit not found"), + ] + )] public function deleteQuestionValue($summit_id, $question_id, $value_id) { return $this->processRequest(function () use ($summit_id, $question_id, $value_id) { @@ -292,6 +533,31 @@ public function deleteQuestionValue($summit_id, $question_id, $value_id) * @param $summit_id * @return mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/order-extra-questions/seed-defaults", + operationId: "seedDefaultOrderExtraQuestions", + description: "Seed default order extra questions from EventBrite", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: "Default questions seeded successfully", + content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + ), + 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 seedDefaultSummitExtraOrderQuestionTypesBySummit($summit_id) { return $this->processRequest(function () use ($summit_id) { @@ -322,6 +588,36 @@ public function seedDefaultSummitExtraOrderQuestionTypesBySummit($summit_id) * @param $question_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules", + operationId: "getSubQuestionRules", + description: "Get sub question rules for an order extra question", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Sub question rules retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Question or Summit not found"), + ] + )] public function getSubQuestionRules($summit_id, $question_id) { return $this->processRequest(function () use ($summit_id, $question_id) { @@ -358,6 +654,44 @@ public function getSubQuestionRules($summit_id, $question_id) * @param $summit_id * @param $question_id */ + #[OA\Post( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules", + operationId: "addSubQuestionRule", + description: "Add a sub question rule to an order extra question", + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") + ), + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_CREATED, + description: "Sub question rule created successfully", + content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") + ), + 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: "Question or Summit not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + ] + )] public function addSubQuestionRule($summit_id, $question_id) { return $this->processRequest(function () use ($summit_id, $question_id) { @@ -385,6 +719,51 @@ public function addSubQuestionRule($summit_id, $question_id) * @param $question_id * @param $rule_id */ + #[OA\Put( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules/{rule_id}", + operationId: "updateSubQuestionRule", + description: "Update a sub question rule", + requestBody: new OA\RequestBody( + required: true, + content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") + ), + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "rule_id", + description: "Rule ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Sub question rule updated successfully", + content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") + ), + 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: "Rule, Question or Summit not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + ] + )] public function updateSubQuestionRule($summit_id, $question_id, $rule_id) { return $this->processRequest(function () use ($summit_id, $question_id, $rule_id) { @@ -414,6 +793,43 @@ public function updateSubQuestionRule($summit_id, $question_id, $rule_id) * @param $rule_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules/{rule_id}", + operationId: "getSubQuestionRule", + description: "Get a specific sub question rule", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "rule_id", + description: "Rule ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Sub question rule retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Rule, Question or Summit not found"), + ] + )] public function getSubQuestionRule($summit_id, $question_id, $rule_id) { return $this->processRequest(function () use ($summit_id, $question_id, $rule_id) { @@ -446,6 +862,41 @@ public function getSubQuestionRule($summit_id, $question_id, $rule_id) * @param $rule_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Delete( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules/{rule_id}", + operationId: "deleteSubQuestionRule", + description: "Delete a sub question rule", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "rule_id", + description: "Rule ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response(response: Response::HTTP_NO_CONTENT, description: "Sub question rule 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: "Rule, Question or Summit not found"), + ] + )] public function deleteSubQuestionRule($summit_id, $question_id, $rule_id) { return $this->processRequest(function () use ($summit_id, $question_id, $rule_id) { @@ -461,6 +912,29 @@ public function deleteSubQuestionRule($summit_id, $question_id, $rule_id) * @param $summit_id * @return mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/attendees/me/allowed-extra-questions", + operationId: "getOwnAttendeeAllowedExtraQuestions", + description: "Get allowed extra questions for the current user's attendance", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Allowed questions retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit or attendee not found"), + ] + )] public function getOwnAttendeeAllowedExtraQuestions($summit_id) { return $this->processRequest(function () use ($summit_id) { @@ -480,6 +954,38 @@ public function getOwnAttendeeAllowedExtraQuestions($summit_id) * @param $attendee_id * @return mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/attendees/{attendee_id}/allowed-extra-questions", + operationId: "getAttendeeAllowedExtraQuestions", + description: "Get allowed extra questions for a specific attendee", + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "attendee_id", + description: "Attendee ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Allowed questions retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + ), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "You are not Authorized"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit or attendee not found"), + ] + )] public function getAttendeeExtraQuestions($summit_id, $attendee_id) { $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); diff --git a/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php b/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php new file mode 100644 index 000000000..634e92fae --- /dev/null +++ b/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php @@ -0,0 +1,74 @@ + Date: Mon, 8 Dec 2025 16:50:04 +0000 Subject: [PATCH 2/6] feat: Add PR requested changes --- ...mitOrderExtraQuestionTypeApiController.php | 220 ++++++++++++++++-- .../OrderExtraQuestionTypeAuthSchema.php | 26 +++ ...h2.php => SummitAdminGroupsAuthSchema.php} | 0 3 files changed, 233 insertions(+), 13 deletions(-) create mode 100644 app/Swagger/Security/OrderExtraQuestionTypeAuthSchema.php rename app/Swagger/Security/{SummitAdminGroupsOauth2.php => SummitAdminGroupsAuthSchema.php} (100%) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php index f08df7cae..46d5898aa 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php @@ -17,6 +17,7 @@ use App\Models\Foundation\Summit\Repositories\ISummitOrderExtraQuestionTypeRepository; use App\ModelSerializers\SerializerUtils; use App\Rules\Boolean; +use App\Security\SummitScopes; use App\Services\Model\ISummitOrderExtraQuestionTypeService; use libs\utils\HTMLCleaner; use models\exceptions\EntityNotFoundException; @@ -45,6 +46,13 @@ final class OAuth2SummitOrderExtraQuestionTypeApiController { use GetAndValidateJsonPayload; + use GetAllBySummit; + use GetSummitChildElementById; + use AddSummitChildElement; + use UpdateSummitChildElement; + use DeleteSummitChildElement; + use RequestProcessor; + use ParametrizedGetAll; /** * @var ISummitRepository @@ -77,19 +85,164 @@ public function __construct $this->repository = $repository; } - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - use RequestProcessor; + #[OA\Get( + path: "/api/v1/summits/{id}/order-extra-questions", + operationId: "getAllOrderExtraQuestions", + description: "Get all order extra questions for a summit", + summary: "Get all order extra questions", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + 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: 20), + description: "Items per page" + ), + new OA\Parameter( + name: "filter", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Filter by name, type, usage, label, class, has_ticket_types, has_badge_feature_types" + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Order by id, name, label, order" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships" + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Order extra questions retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), + ] + )] + #[OA\Get( + path: "/api/public/v1/summits/{id}/order-extra-questions", + operationId: "getAllOrderExtraQuestionsPublic", + description: "Get all order extra questions for a summit (public endpoint)", + tags: ["Order Extra Questions (Public)"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + 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: 20), + description: "Items per page" + ), + new OA\Parameter( + name: "filter", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Filter by name, type, usage, label, class, has_ticket_types, has_badge_feature_types" + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Order by id, name, label, order" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships" + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Order extra questions retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), + ] + )] - use ParametrizedGetAll; + #[OA\Get( + path: "/api/v1/summits/{id}/order-extra-questions/{question_id}", + operationId: "getOrderExtraQuestion", + description: "Get a specific order extra question by ID", + summary: "Get order extra question by ID", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], + tags: ["Order Extra Questions"], + parameters: [ + new OA\Parameter( + name: "id", + description: "Summit ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "question_id", + description: "Question ID", + in: "path", + required: true, + schema: new OA\Schema(type: "integer", format: "int64") + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships" + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Order extra question retrieved successfully", + content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Question or Summit not found"), + ] + )] /** * @param $summit_id @@ -99,6 +252,9 @@ public function __construct path: "/api/v1/summits/{id}/order-extra-questions/metadata", operationId: "getOrderExtraQuestionsMetadata", description: "Get metadata for order extra questions", + summary: "Get metadata for order extra questions", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -194,6 +350,9 @@ function getAddValidationRules(array $payload): array path: "/api/v1/summits/{id}/order-extra-questions", operationId: "addOrderExtraQuestion", description: "Add a new order extra question", + summary: "Add a new order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") @@ -244,6 +403,9 @@ protected function getSummitRepository(): ISummitRepository path: "/api/v1/summits/{id}/order-extra-questions/{question_id}", operationId: "deleteOrderExtraQuestion", description: "Delete an order extra question", + summary: "Delete an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -299,6 +461,9 @@ function getUpdateValidationRules(array $payload): array path: "/api/v1/summits/{id}/order-extra-questions/{question_id}", operationId: "updateOrderExtraQuestion", description: "Update an order extra question", + summary: "Update an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: "#/components/schemas/SummitOrderExtraQuestionType") @@ -351,6 +516,9 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/values", operationId: "addOrderExtraQuestionValue", description: "Add a value to an order extra question", + summary: "Add a value to an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators]], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: "#/components/schemas/ExtraQuestionTypeValue") @@ -416,6 +584,9 @@ public function addQuestionValue($summit_id, $question_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/values/{value_id}", operationId: "updateOrderExtraQuestionValue", description: "Update a value of an order extra question", + summary: "Update a value of an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: "#/components/schemas/ExtraQuestionTypeValue") @@ -486,6 +657,9 @@ public function updateQuestionValue($summit_id, $question_id, $value_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/values/{value_id}", operationId: "deleteOrderExtraQuestionValue", description: "Delete a value from an order extra question", + summary: "Delete a value from an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -537,6 +711,9 @@ public function deleteQuestionValue($summit_id, $question_id, $value_id) path: "/api/v1/summits/{id}/order-extra-questions/seed-defaults", operationId: "seedDefaultOrderExtraQuestions", description: "Seed default order extra questions from EventBrite", + summary: "Seed default order extra questions from EventBrite", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -592,6 +769,8 @@ public function seedDefaultSummitExtraOrderQuestionTypesBySummit($summit_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules", operationId: "getSubQuestionRules", description: "Get sub question rules for an order extra question", + summary: "Get sub question rules for an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -658,6 +837,9 @@ public function getSubQuestionRules($summit_id, $question_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules", operationId: "addSubQuestionRule", description: "Add a sub question rule to an order extra question", + summary: "Add a sub question rule to an order extra question", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") @@ -723,6 +905,9 @@ public function addSubQuestionRule($summit_id, $question_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules/{rule_id}", operationId: "updateSubQuestionRule", description: "Update a sub question rule", + summary: "Update a sub question rule", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent(ref: "#/components/schemas/SubQuestionRule") @@ -797,6 +982,8 @@ public function updateSubQuestionRule($summit_id, $question_id, $rule_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules/{rule_id}", operationId: "getSubQuestionRule", description: "Get a specific sub question rule", + summary: "Get a specific sub question rule", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -866,6 +1053,9 @@ public function getSubQuestionRule($summit_id, $question_id, $rule_id) path: "/api/v1/summits/{id}/order-extra-questions/{question_id}/sub-question-rules/{rule_id}", operationId: "deleteSubQuestionRule", description: "Delete a sub question rule", + summary: "Delete a sub question rule", + security: [['order_extra_questions_oauth2' => [SummitScopes::WriteSummitData]]], + x: ['required-groups' => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::SummitAdministrators, IGroup::SummitRegistrationAdmins]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -916,6 +1106,8 @@ public function deleteSubQuestionRule($summit_id, $question_id, $rule_id) path: "/api/v1/summits/{id}/attendees/me/allowed-extra-questions", operationId: "getOwnAttendeeAllowedExtraQuestions", description: "Get allowed extra questions for the current user's attendance", + summary: "Get allowed extra questions for the current user's attendance", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -958,6 +1150,8 @@ public function getOwnAttendeeAllowedExtraQuestions($summit_id) path: "/api/v1/summits/{id}/attendees/{attendee_id}/allowed-extra-questions", operationId: "getAttendeeAllowedExtraQuestions", description: "Get allowed extra questions for a specific attendee", + summary: "Get allowed extra questions for a specific attendee", + security: [['order_extra_questions_oauth2' => [SummitScopes::ReadSummitData, SummitScopes::ReadAllSummitData]]], tags: ["Order Extra Questions"], parameters: [ new OA\Parameter( @@ -1082,4 +1276,4 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($attendee) ['attendee' => $attendee] ); } -} \ No newline at end of file +} diff --git a/app/Swagger/Security/OrderExtraQuestionTypeAuthSchema.php b/app/Swagger/Security/OrderExtraQuestionTypeAuthSchema.php new file mode 100644 index 000000000..4c706f34c --- /dev/null +++ b/app/Swagger/Security/OrderExtraQuestionTypeAuthSchema.php @@ -0,0 +1,26 @@ + 'Read Summit Data', + SummitScopes::ReadAllSummitData => 'Read All Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ] + ) + ] +)] +class OrderExtraQuestionTypeAuthSchema {} diff --git a/app/Swagger/Security/SummitAdminGroupsOauth2.php b/app/Swagger/Security/SummitAdminGroupsAuthSchema.php similarity index 100% rename from app/Swagger/Security/SummitAdminGroupsOauth2.php rename to app/Swagger/Security/SummitAdminGroupsAuthSchema.php From 4d39d2cf446731df1a6ebfb3f9850427396f9ef7 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 8 Dec 2025 16:54:29 +0000 Subject: [PATCH 3/6] chore: move the properties inside the schema definition, and create an empry class --- app/Swagger/schemas.php | 50 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/app/Swagger/schemas.php b/app/Swagger/schemas.php index 8596a021d..03d879aac 100644 --- a/app/Swagger/schemas.php +++ b/app/Swagger/schemas.php @@ -501,51 +501,35 @@ class RSVPAdminAddRequestSchema #[OA\Schema( schema: "ExtraQuestionTypeValue", description: "Extra Question Type Value", - type: "object" + type: "object", + properties: [ + new OA\Property(property: "id", type: "integer", format: "int64", example: 1), + new OA\Property(property: "value", type: "string", example: "Value 1"), + new OA\Property(property: "label", type: "string", example: "Label 1"), + new OA\Property(property: "order", type: "integer", format: "int32", example: 1), + new OA\Property(property: "question_id", type: "integer", format: "int64", example: 10), + ] )] class ExtraQuestionTypeValue { - #[OA\Property(property: "id", type: "integer", format: "int64")] - public int $id; - - #[OA\Property(property: "value", type: "string")] - public string $value; - - #[OA\Property(property: "label", type: "string")] - public string $label; - - #[OA\Property(property: "order", type: "integer", format: "int32")] - public int $order; - - #[OA\Property(property: "question_id", type: "integer", format: "int64")] - public int $question_id; } // SubQuestionRule Schema #[OA\Schema( schema: "SubQuestionRule", description: "Sub Question Rule", - type: "object" + type: "object", + properties: [ + new OA\Property(property: "id", type: "integer", format: "int64"), + new OA\Property(property: "parent_question_id", type: "integer", format: "int64"), + new OA\Property(property: "parent_question_value_id", type: "integer", format: "int64"), + new OA\Property(property: "sub_question_id", type: "integer", format: "int64"), + new OA\Property(property: "visibility", type: "string", enum: ["Visible", "Hidden"]), + new OA\Property(property: "logic", type: "string", enum: ["And", "Or"]), + ] )] class SubQuestionRule { - #[OA\Property(property: "id", type: "integer", format: "int64")] - public int $id; - - #[OA\Property(property: "parent_question_id", type: "integer", format: "int64")] - public int $parent_question_id; - - #[OA\Property(property: "parent_question_value_id", type: "integer", format: "int64")] - public int $parent_question_value_id; - - #[OA\Property(property: "sub_question_id", type: "integer", format: "int64")] - public int $sub_question_id; - - #[OA\Property(property: "visibility", type: "string", enum: ["Visible", "Hidden"])] - public string $visibility; - - #[OA\Property(property: "logic", type: "string", enum: ["And", "Or"])] - public string $logic; } // Legal Documents From d5f8f1fa720adf7459bb88798666e26acf0d247c Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 8 Dec 2025 16:55:54 +0000 Subject: [PATCH 4/6] chore: move the properties inside the schema definition, and create an empry class --- .../SummitOrderExtraQuestionTypeSchemas.php | 97 +++++++------------ 1 file changed, 35 insertions(+), 62 deletions(-) diff --git a/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php b/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php index 634e92fae..08379af59 100644 --- a/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php +++ b/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php @@ -7,68 +7,41 @@ #[OA\Schema( schema: "SummitOrderExtraQuestionType", description: "Summit Order Extra Question Type", - type: "object" + type: "object", + properties: [ + new OA\Property(property: "id", type: "integer", format: "int64", example: 1), + new OA\Property(property: "name", type: "string", example: "extra_question_1"), + new OA\Property(property: "label", type: "string", example: "Extra Question 1"), + new OA\Property(property: "type", type: "string", enum: ["Text", "TextArea", "DropDown", "CheckBox", "RadioButtonList", "CheckBoxList"], example: "Text"), + new OA\Property(property: "class", type: "string", enum: ["Main", "SubQuestion"], example: "Main"), + new OA\Property(property: "usage", type: "string", enum: ["BothQuestionUsage", "TicketQuestionUsage", "OrderQuestionUsage"], example: "OrderQuestionUsage"), + new OA\Property(property: "printable", type: "boolean", example: true), + new OA\Property(property: "order", type: "integer", format: "int32", example: 1), + new OA\Property(property: "mandatory", type: "boolean", example: false), + new OA\Property(property: "is_deletable", type: "boolean", example: true), + new OA\Property(property: "summit_id", type: "integer", format: "int64", example: 10), + new OA\Property( + property: "values", + type: "array", + items: new OA\Items(ref: "#/components/schemas/ExtraQuestionTypeValue") + ), + new OA\Property( + property: "sub_question_rules", + type: "array", + items: new OA\Items(ref: "#/components/schemas/SubQuestionRule") + ), + new OA\Property( + property: "allowed_ticket_types", + type: "array", + items: new OA\Items(type: "integer", format: "int64") + ), + new OA\Property( + property: "allowed_badge_features_types", + type: "array", + items: new OA\Items(type: "integer", format: "int64") + ), + ] )] class SummitOrderExtraQuestionTypeSchemas { - #[OA\Property(property: "id", type: "integer", format: "int64")] - public int $id; - - #[OA\Property(property: "name", type: "string")] - public string $name; - - #[OA\Property(property: "label", type: "string")] - public string $label; - - #[OA\Property(property: "type", type: "string", enum: ["Text", "TextArea", "DropDown", "CheckBox", "RadioButtonList", "CheckBoxList"])] - public string $type; - - #[OA\Property(property: "class", type: "string", enum: ["Main", "SubQuestion"])] - public string $class; - - #[OA\Property(property: "usage", type: "string", enum: ["BothQuestionUsage", "TicketQuestionUsage", "OrderQuestionUsage"])] - public string $usage; - - #[OA\Property(property: "printable", type: "boolean")] - public bool $printable; - - #[OA\Property(property: "order", type: "integer", format: "int32")] - public int $order; - - #[OA\Property(property: "mandatory", type: "boolean")] - public bool $mandatory; - - #[OA\Property(property: "is_deletable", type: "boolean")] - public bool $is_deletable; - - #[OA\Property(property: "summit_id", type: "integer", format: "int64")] - public int $summit_id; - - #[OA\Property( - property: "values", - type: "array", - items: new OA\Items(ref: "#/components/schemas/ExtraQuestionTypeValue") - )] - public array $values; - - #[OA\Property( - property: "sub_question_rules", - type: "array", - items: new OA\Items(ref: "#/components/schemas/SubQuestionRule") - )] - public array $sub_question_rules; - - #[OA\Property( - property: "allowed_ticket_types", - type: "array", - items: new OA\Items(type: "integer", format: "int64") - )] - public array $allowed_ticket_types; - - #[OA\Property( - property: "allowed_badge_features_types", - type: "array", - items: new OA\Items(type: "integer", format: "int64") - )] - public array $allowed_badge_features_types; -} \ No newline at end of file +} From d723afe40f35bcf7ed8eeb606ffa41235b366dc0 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 23 Jan 2026 22:09:50 +0000 Subject: [PATCH 5/6] chore: Add its own pagination schemas Signed-off-by: Matias Perrone --- ...mitOrderExtraQuestionTypeApiController.php | 13 ++++--- .../SummitOrderExtraQuestionTypeSchemas.php | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php index 46d5898aa..cf12a1e82 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php @@ -40,7 +40,6 @@ * Class OAuth2SummitOrderExtraQuestionTypeApiController * @package App\Http\Controllers */ -#[OA\Tag(name: "Order Extra Questions", description: "Summit Order Extra Questions Management")] final class OAuth2SummitOrderExtraQuestionTypeApiController extends OAuth2ProtectedController { @@ -140,7 +139,7 @@ public function __construct new OA\Response( response: Response::HTTP_OK, description: "Order extra questions retrieved successfully", - content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitOrderExtraQuestionTypesResponse") ), new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), ] @@ -198,7 +197,7 @@ public function __construct new OA\Response( response: Response::HTTP_OK, description: "Order extra questions retrieved successfully", - content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitOrderExtraQuestionTypesResponse") ), new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), ] @@ -728,7 +727,7 @@ public function deleteQuestionValue($summit_id, $question_id, $value_id) new OA\Response( response: Response::HTTP_CREATED, description: "Default questions seeded successfully", - content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitOrderExtraQuestionTypesResponse") ), new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), @@ -792,7 +791,7 @@ public function seedDefaultSummitExtraOrderQuestionTypesBySummit($summit_id) new OA\Response( response: Response::HTTP_OK, description: "Sub question rules retrieved successfully", - content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSubQuestionRulesResponse") ), new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Question or Summit not found"), ] @@ -1122,7 +1121,7 @@ public function deleteSubQuestionRule($summit_id, $question_id, $rule_id) new OA\Response( response: Response::HTTP_OK, description: "Allowed questions retrieved successfully", - content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitOrderExtraQuestionTypesResponse") ), new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit or attendee not found"), ] @@ -1173,7 +1172,7 @@ public function getOwnAttendeeAllowedExtraQuestions($summit_id) new OA\Response( response: Response::HTTP_OK, description: "Allowed questions retrieved successfully", - content: new OA\JsonContent(ref: "#/components/schemas/PaginateDataSchemaResponse") + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitOrderExtraQuestionTypesResponse") ), new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), new OA\Response(response: Response::HTTP_FORBIDDEN, description: "You are not Authorized"), diff --git a/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php b/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php index 08379af59..0b0a285ff 100644 --- a/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php +++ b/app/Swagger/SummitOrderExtraQuestionTypeSchemas.php @@ -45,3 +45,39 @@ class SummitOrderExtraQuestionTypeSchemas { } + +#[OA\Schema( + schema: "PaginatedSummitOrderExtraQuestionTypesResponse", + description: "Paginated list of summit order extra question types", + 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/SummitOrderExtraQuestionType") + ) + ] + ) + ] +)] +class PaginatedSummitOrderExtraQuestionTypesResponseSchema {} + +#[OA\Schema( + schema: "PaginatedSubQuestionRulesResponse", + description: "Paginated list of sub question rules", + 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/SubQuestionRule") + ) + ] + ) + ] +)] +class PaginatedSubQuestionRulesResponseSchema {} From 1dc3ca096e606da3c4855acc54786c48511a0b74 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Fri, 23 Jan 2026 22:22:58 +0000 Subject: [PATCH 6/6] chore: Add missing relations and expand fields Signed-off-by: Matias Perrone --- ...mitOrderExtraQuestionTypeApiController.php | 139 +++++++++++++++++- 1 file changed, 136 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php index cf12a1e82..2cb5ed9b9 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php @@ -127,12 +127,19 @@ public function __construct schema: new OA\Schema(type: "string"), description: "Order by id, name, label, order" ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), new OA\Parameter( name: "expand", in: "query", required: false, schema: new OA\Schema(type: "string"), - description: "Expand relationships" + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" ), ], responses: [ @@ -185,12 +192,19 @@ public function __construct schema: new OA\Schema(type: "string"), description: "Order by id, name, label, order" ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), new OA\Parameter( name: "expand", in: "query", required: false, schema: new OA\Schema(type: "string"), - description: "Expand relationships" + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" ), ], responses: [ @@ -225,12 +239,19 @@ public function __construct required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), new OA\Parameter( name: "expand", in: "query", required: false, schema: new OA\Schema(type: "string"), - description: "Expand relationships" + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" ), ], responses: [ @@ -365,6 +386,20 @@ function getAddValidationRules(array $payload): array required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), ], responses: [ new OA\Response( @@ -538,6 +573,20 @@ protected function updateChild(Summit $summit, int $child_id, array $payload): I required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), ], responses: [ new OA\Response( @@ -613,6 +662,20 @@ public function addQuestionValue($summit_id, $question_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), ], responses: [ new OA\Response( @@ -722,6 +785,20 @@ public function deleteQuestionValue($summit_id, $question_id, $value_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), ], responses: [ new OA\Response( @@ -786,6 +863,13 @@ public function seedDefaultSummitExtraOrderQuestionTypesBySummit($summit_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: sub_question, parent_question" + ), ], responses: [ new OA\Response( @@ -859,6 +943,13 @@ public function getSubQuestionRules($summit_id, $question_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: sub_question, parent_question" + ), ], responses: [ new OA\Response( @@ -934,6 +1025,13 @@ public function addSubQuestionRule($summit_id, $question_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: sub_question, parent_question" + ), ], responses: [ new OA\Response( @@ -1006,6 +1104,13 @@ public function updateSubQuestionRule($summit_id, $question_id, $rule_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: sub_question, parent_question" + ), ], responses: [ new OA\Response( @@ -1116,6 +1221,20 @@ public function deleteSubQuestionRule($summit_id, $question_id, $rule_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), ], responses: [ new OA\Response( @@ -1167,6 +1286,20 @@ public function getOwnAttendeeAllowedExtraQuestions($summit_id) required: true, schema: new OA\Schema(type: "integer", format: "int64") ), + new OA\Parameter( + name: "relations", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + schema: new OA\Schema(type: "string"), + description: "Expand relationships, possible values: allowed_ticket_types, allowed_badge_features_types, sub_question_rules, parent_rules" + ), ], responses: [ new OA\Response(