diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php index d4a4f3d3f..a9b9f230c 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php @@ -1,4 +1,7 @@ -summit_repository = $summit_repository; $this->service = $service; parent::__construct($resource_server_context); } + // OpenAPI Documentation + + #[OA\Put( + path: '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/actions/{action_type_id}/complete', + operationId: 'completePresentationAction', + summary: 'Mark a presentation action as completed', + description: 'Marks a specific action for a presentation as completed by a track chair. Track chairs use presentation actions to manage the review process (e.g., "Review Video", "Check Speakers", "Verify Content"). Only track chairs and track chair admins can perform this action.', + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::TrackChairs, + IGroup::TrackChairsAdmins, + ] + ], + security: [ + [ + 'presentation_actions_oauth2' => [ + SummitScopes::WriteSummitData, + SummitScopes::WriteEventData, + ] + ] + ], + tags: ['Presentation Actions'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'selection_plan_id', + in: 'path', + required: true, + description: 'Selection Plan ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'presentation_id', + in: 'path', + required: true, + description: 'Presentation ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'action_type_id', + in: 'path', + required: true, + description: 'Action Type ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'expand', + in: 'query', + required: false, + description: 'Expand relationships. Available: presentation, type, created_by, updated_by', + schema: new OA\Schema(type: 'string', example: 'type,created_by') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Presentation action marked as completed successfully', + content: new OA\JsonContent(ref: '#/components/schemas/PresentationAction') + ), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden - User must be a track chair or track chair admin"), + 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"), + ] + )] + /** * @param $summit_id * @param $selection_plan_id * @param $presentation_id * @param $action_type_id */ - public function complete($summit_id, $selection_plan_id, $presentation_id, $action_type_id){ + public function complete($summit_id, $selection_plan_id, $presentation_id, $action_type_id) + { try { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); $member = $this->resource_server_context->getCurrentUser(); @@ -78,7 +162,7 @@ public function complete($summit_id, $selection_plan_id, $presentation_id, $acti if (!$authz) return $this->error403(); - $action = $this->service->updateAction($summit, intval($selection_plan_id), intval($presentation_id), intval($action_type_id), true ); + $action = $this->service->updateAction($summit, intval($selection_plan_id), intval($presentation_id), intval($action_type_id), true); return $this->updated(SerializerRegistry::getInstance()->getSerializer($action)->serialize(Request::input('expand', ''))); } catch (ValidationException $ex) { @@ -93,17 +177,91 @@ public function complete($summit_id, $selection_plan_id, $presentation_id, $acti } } + #[OA\Delete( + path: '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/actions/{action_type_id}/incomplete', + operationId: 'incompletePresentationAction', + summary: 'Mark a presentation action as incomplete', + description: 'Unmarks a completed presentation action, setting it back to incomplete status. This allows track chairs to revert an action they previously marked as done. Only track chairs and track chair admins can perform this action.', + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::TrackChairs, + IGroup::TrackChairsAdmins, + ] + ], + security: [ + [ + 'presentation_actions_oauth2' => [ + SummitScopes::WriteSummitData, + ] + ] + ], + tags: ['Presentation Actions'], + parameters: [ + new OA\Parameter( + name: 'id', + in: 'path', + required: true, + description: 'Summit ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'selection_plan_id', + in: 'path', + required: true, + description: 'Selection Plan ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'presentation_id', + in: 'path', + required: true, + description: 'Presentation ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'action_type_id', + in: 'path', + required: true, + description: 'Action Type ID', + schema: new OA\Schema(type: 'integer') + ), + new OA\Parameter( + name: 'expand', + in: 'query', + required: false, + description: 'Expand relationships. Available: presentation, type, created_by, updated_by', + schema: new OA\Schema(type: 'string', example: 'type,created_by') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Presentation action marked as incomplete successfully', + content: new OA\JsonContent(ref: '#/components/schemas/PresentationAction') + ), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden - User must be a track chair or track chair admin"), + 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"), + ] + )] + /** * @param $summit_id * @param $selection_plan_id * @param $presentation_id * @param $action_type_id */ - public function uncomplete($summit_id, $selection_plan_id, $presentation_id, $action_type_id){ + public function uncomplete($summit_id, $selection_plan_id, $presentation_id, $action_type_id) + { try { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); $member = $this->resource_server_context->getCurrentUser(); @@ -115,7 +273,7 @@ public function uncomplete($summit_id, $selection_plan_id, $presentation_id, $ac if (!$authz) return $this->error403(); - $action = $this->service->updateAction($summit, intval($selection_plan_id), intval($presentation_id), intval($action_type_id), false ); + $action = $this->service->updateAction($summit, intval($selection_plan_id), intval($presentation_id), intval($action_type_id), false); return $this->updated(SerializerRegistry::getInstance()->getSerializer($action)->serialize(Request::input('expand', ''))); } catch (ValidationException $ex) { diff --git a/app/Swagger/Models/PresentationActionSchema.php b/app/Swagger/Models/PresentationActionSchema.php new file mode 100644 index 000000000..23a8d15ae --- /dev/null +++ b/app/Swagger/Models/PresentationActionSchema.php @@ -0,0 +1,27 @@ + 'Write Summit Data', + SummitScopes::WriteEventData => 'Write Event Data', + ], + ), + ], +) +] +class PresentationActionsAuthSchema +{ +} diff --git a/app/Swagger/SummitPresentationSchemas.php b/app/Swagger/SummitPresentationSchemas.php index 6b3e2f895..8de16ad2e 100644 --- a/app/Swagger/SummitPresentationSchemas.php +++ b/app/Swagger/SummitPresentationSchemas.php @@ -2,6 +2,4 @@ namespace App\Swagger\schemas; -use OpenApi\Attributes as OA; - -// +use OpenApi\Attributes as OA; \ No newline at end of file