diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php index c03107e69..c3f0ce28f 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php @@ -13,8 +13,11 @@ **/ use App\Models\Exceptions\AuthzException; +use App\Models\Foundation\Main\IGroup; use App\ModelSerializers\SerializerUtils; +use App\Security\SummitScopes; use App\Services\Model\ISummitSelectedPresentationListService; +use Illuminate\Http\Response; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Validator; use models\main\IMemberRepository; @@ -22,6 +25,7 @@ use models\summit\ISummitRepository; use models\summit\SummitSelectedPresentation; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; /** * Class OAuth2SummitSelectedPresentationListApiController @@ -73,6 +77,48 @@ public function __construct * @param $track_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/team", + operationId: 'getTeamSelectionList', + summary: "Get team selection list for a track", + security: [["selected_presentation_list_oauth2" => [SummitScopes::ReadSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function getTeamSelectionList($summit_id, $selection_plan_id, $track_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id){ @@ -101,6 +147,49 @@ public function getTeamSelectionList($summit_id, $selection_plan_id, $track_id){ * @param $track_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/team", + operationId: 'createTeamSelectionList', + summary: "Create team selection list for a track", + security: [["selected_presentation_list_oauth2" => [SummitScopes::WriteSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ) + ], + responses: [ + new OA\Response( + response: 201, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function createTeamSelectionList($summit_id, $selection_plan_id, $track_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id){ @@ -125,6 +214,55 @@ public function createTeamSelectionList($summit_id, $selection_plan_id, $track_i * @param $owner_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/individual/owner/{owner_id}", + operationId: 'getIndividualSelectionList', + summary: "Get individual selection list for a specific owner", + security: [["selected_presentation_list_oauth2" => [SummitScopes::ReadSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ), + new OA\Parameter( + name: "owner_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The owner/member id" + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function getIndividualSelectionList($summit_id, $selection_plan_id, $track_id, $owner_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id, $owner_id){ @@ -149,6 +287,49 @@ public function getIndividualSelectionList($summit_id, $selection_plan_id, $trac * @param $owner_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/individual/owner/me", + operationId: 'createIndividualSelectionList', + summary: "Create individual selection list for current user", + security: [["selected_presentation_list_oauth2" => [SummitScopes::WriteSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ) + ], + responses: [ + new OA\Response( + response: 201, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function createIndividualSelectionList($summit_id, $selection_plan_id, $track_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id) { @@ -172,6 +353,64 @@ public function createIndividualSelectionList($summit_id, $selection_plan_id, $t * @param $list_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Put( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/{list_id}/reorder", + operationId: 'reorderSelectionList', + summary: "Reorder presentations in a selection list", + security: [["selected_presentation_list_oauth2" => [SummitScopes::WriteSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ), + new OA\Parameter( + name: "list_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection list id" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/SummitSelectedPresentationListReorderRequest") + ) + ), + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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 reorderSelectionList($summit_id, $selection_plan_id, $track_id, $list_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id, $list_id) { @@ -219,6 +458,63 @@ public function reorderSelectionList($summit_id, $selection_plan_id, $track_id, * @param $presentation_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/individual/presentation-selections/{collection}/presentations/{presentation_id}", + operationId: 'assignPresentationToMyIndividualList', + summary: "Assign a presentation to current user's individual selection list", + security: [["selected_presentation_list_oauth2" => [SummitScopes::WriteSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ), + new OA\Parameter( + name: "collection", + in: "path", + required: true, + schema: new OA\Schema(type: "string", enum: ["selected", "maybe"]), + description: "The collection type (selected or maybe)" + ), + new OA\Parameter( + name: "presentation_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The presentation id" + ) + ], + responses: [ + new OA\Response( + response: 201, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function assignPresentationToMyIndividualList($summit_id, $selection_plan_id, $track_id, $collection, $presentation_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id, $collection,$presentation_id) { @@ -244,6 +540,63 @@ public function assignPresentationToMyIndividualList($summit_id, $selection_plan * @param $presentation_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Delete( + path: "/api/v1/summits/{id}/selection-plans/{selection_plan_id}/tracks/{track_id}/selection-lists/individual/presentation-selections/{collection}/presentations/{presentation_id}", + operationId: 'removePresentationFromMyIndividualList', + summary: "Remove a presentation from current user's individual selection list", + security: [["selected_presentation_list_oauth2" => [SummitScopes::WriteSummitData]]], + x: ["authz_groups" => [IGroup::SuperAdmins, IGroup::Administrators, IGroup::TrackChairs, IGroup::TrackChairsAdmins]], + tags: ["Summit Selected Presentation Lists"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "selection_plan_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The selection plan id" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ), + new OA\Parameter( + name: "collection", + in: "path", + required: true, + schema: new OA\Schema(type: "string", enum: ["selected", "maybe"]), + description: "The collection type (selected or maybe)" + ), + new OA\Parameter( + name: "presentation_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The presentation id" + ) + ], + responses: [ + new OA\Response( + response: 201, + description: "Removed from List", + content: new OA\JsonContent(ref: "#/components/schemas/SummitSelectedPresentationList") + ), + 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function removePresentationFromMyIndividualList($summit_id, $selection_plan_id, $track_id, $collection, $presentation_id){ return $this->processRequest(function () use($summit_id, $selection_plan_id, $track_id, $collection,$presentation_id) { @@ -260,4 +613,4 @@ public function removePresentationFromMyIndividualList($summit_id, $selection_pl )); }); } -} \ No newline at end of file +} diff --git a/app/Swagger/Security/SelectedPresentationListAuthSchema.php b/app/Swagger/Security/SelectedPresentationListAuthSchema.php new file mode 100644 index 000000000..45d48a66f --- /dev/null +++ b/app/Swagger/Security/SelectedPresentationListAuthSchema.php @@ -0,0 +1,25 @@ + 'Read Summit Data', + SummitScopes::WriteSummitData => 'Write Summit Data', + ], + ), + ], + ) +] +class SelectedPresentationListAuthSchema {} diff --git a/app/Swagger/SummitPresentationSchemas.php b/app/Swagger/SummitPresentationSchemas.php index 8f8a3cf2c..42d830edd 100644 --- a/app/Swagger/SummitPresentationSchemas.php +++ b/app/Swagger/SummitPresentationSchemas.php @@ -81,3 +81,34 @@ class PresentationTrackChairRatingTypeCreateRequestSchema {} class PresentationTrackChairRatingTypeUpdateRequestSchema {} // + + +#[OA\Schema( + schema: "SummitSelectedPresentationList", + 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: "name", type: "string", example: "My Selection List"), + new OA\Property(property: "type", type: "string", enum: ["Individual", "Group"], example: "Individual"), + new OA\Property(property: "hash", type: "string", example: "abc123def456"), + new OA\Property(property: "selected_presentations", type: "array", items: new OA\Items(type: "integer"), description: "Array of SummitSelectedPresentation IDs of collection \"selected\", full objects when ?expand=selected_presentations" ), + new OA\Property(property: "interested_presentations", type: "array", items: new OA\Items(type: "integer"), description: "Array of SummitSelectedPresentation IDs of collection \"maybe\", full objects when ?expand=interested_presentations", nullable: true), + new OA\Property(property: "category_id", type: "integer", example: 5, description: "PresentationCategory ID, full object when ?expand=category", nullable: true), + new OA\Property(property: "owner_id", type: "integer", example: 10, nullable: true, description: "Member ID not present when ?expand=owner"), + new OA\Property(property: "owner", ref: "#/components/schemas/Member", description: "Member full object when ?expand=owner)", nullable: true), + new OA\Property(property: "selection_plan_id", type: "integer", example: 3, description: "SelectionPlan ID, full object when ?expand=selection_plan)", nullable: true), + ] +)] +class SummitSelectedPresentationList {} + +#[OA\Schema( + schema: "SummitSelectedPresentationListReorderRequest", + required: ["collection"], + properties: [ + new OA\Property(property: "hash", type: "string", nullable: true, example: "abc123def456"), + new OA\Property(property: "collection", type: "string", enum: ["selected", "maybe"], example: "selected"), + new OA\Property(property: "presentations", type: "array", items: new OA\Items(type: "integer"), description: "Array of presentation IDs in the desired order", nullable: true), + ] +)] +class SummitSelectedPresentationListReorderRequest {}