diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitProposedScheduleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitProposedScheduleApiController.php index c926010b9..1f242b236 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitProposedScheduleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitProposedScheduleApiController.php @@ -12,6 +12,8 @@ * limitations under the License. **/ +use Illuminate\Http\Response; +use OpenApi\Attributes as OA; use App\Facades\ResourceServerContext; use App\ModelSerializers\SerializerUtils; use App\Rules\Boolean; @@ -88,6 +90,69 @@ protected function getRepository(): IBaseRepository * @param $summit_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/presentations", + summary: "Get proposed schedule events for a specific source", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + 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", + required: false, + explode: false, + schema: new OA\Schema(type: "string"), + description: "Filter operators: start_date==//<=/>=/ [], end_date==//<=/>=/ [], duration==//<=/>=, presentation_title@@/=@, presentation_id==, location_id==, track_id==, type_show_always_on_schedule==" + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + explode: false, + schema: new OA\Schema(type: "string"), + description: "Order by fields: start_date, end_date, presentation_id, presentation_title, track_id" + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitProposedScheduleSummitEventsResponse") + ), + 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 getProposedScheduleEvents($summit_id, $source) { @@ -146,6 +211,55 @@ function () { * @param $presentation_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Put( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/presentations/{presentation_id}/propose", + summary: "Publish a presentation to the proposed schedule", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + new OA\Parameter( + name: "presentation_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The presentation id" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/SummitProposedSchedulePublishRequest") + ) + ), + responses: [ + new OA\Response( + response: 201, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitProposedScheduleSummitEvent") + ), + 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 publish($summit_id, $source, $presentation_id) { @@ -173,6 +287,42 @@ public function publish($summit_id, $source, $presentation_id) * @param $presentation_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Delete( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/presentations/{presentation_id}/propose", + summary: "Unpublish a presentation from the proposed schedule", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + 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: 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_INTERNAL_SERVER_ERROR, description: "Server Error") + ] + )] public function unpublish($summit_id, $source, $presentation_id) { @@ -194,6 +344,56 @@ public function unpublish($summit_id, $source, $presentation_id) * @param $summit_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Put( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/presentations/all/publish", + summary: "Publish all presentations to the proposed schedule with optional filters", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + new OA\Parameter( + name: "filter", + in: "query", + required: false, + explode: false, + schema: new OA\Schema(type: "string"), + description: "Filter operators: start_date==//<=/>=/ [], end_date==//<=/>=/ [], location_id==, track_id==" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/SummitProposedSchedulePublishAllRequest") + ) + ), + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/SummitProposedSchedulePublishAllResponse") + ), + 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 publishAll($summit_id, $source) { @@ -238,6 +438,55 @@ public function publishAll($summit_id, $source) * @param $track_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/tracks/{track_id}/lock", + summary: "Send a track schedule for review (lock the track)", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/SummitProposedScheduleLockRequest") + ) + ), + responses: [ + new OA\Response( + response: 201, + description: "Created", + content: new OA\JsonContent(ref: "#/components/schemas/SummitProposedScheduleLock") + ), + 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 send2Review($summit_id, $source, $track_id) { return $this->processRequest(function () use ($summit_id, $source, $track_id) { @@ -266,6 +515,51 @@ public function send2Review($summit_id, $source, $track_id) * @param $track_id * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Delete( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/tracks/{track_id}/lock", + summary: "Remove review lock from a track schedule (unlock the track)", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + new OA\Parameter( + name: "track_id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The track id" + ) + ], + requestBody: new OA\RequestBody( + required: true, + content: new OA\MediaType( + mediaType: "application/json", + schema: new OA\Schema(ref: "#/components/schemas/SummitProposedScheduleLockRequest") + ) + ), + responses: [ + new OA\Response(response: 204, description: "No Content"), + 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 removeReview($summit_id, $source, $track_id) { return $this->processRequest(function () use ($summit_id, $source, $track_id) { @@ -286,6 +580,69 @@ public function removeReview($summit_id, $source, $track_id) * @param $source * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Get( + path: "/api/v1/summits/{id}/proposed-schedules/{source}/locks", + summary: "Get all proposed schedule review submissions (locks) for a source", + security: [["Bearer" => []]], + tags: ["summit-proposed-schedule"], + parameters: [ + new OA\Parameter( + name: "id", + in: "path", + required: true, + schema: new OA\Schema(type: "integer"), + description: "The summit id" + ), + new OA\Parameter( + name: "source", + in: "path", + required: true, + schema: new OA\Schema(type: "string"), + description: "The source identifier" + ), + 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", + required: false, + explode: false, + schema: new OA\Schema(type: "string"), + description: "Filter operators: track_id==" + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + explode: false, + schema: new OA\Schema(type: "string"), + description: "Order by fields: track_id" + ) + ], + responses: [ + new OA\Response( + response: 200, + description: "OK", + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitProposedScheduleLocksResponse") + ), + 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 getProposedScheduleReviewSubmissions($summit_id, $source) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find(intval($summit_id)); @@ -327,4 +684,4 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit_id } ); } -} \ No newline at end of file +} diff --git a/app/Swagger/SummitProposedScheduleSchemas.php b/app/Swagger/SummitProposedScheduleSchemas.php index 6b3e2f895..6d0c5220c 100644 --- a/app/Swagger/SummitProposedScheduleSchemas.php +++ b/app/Swagger/SummitProposedScheduleSchemas.php @@ -4,4 +4,130 @@ use OpenApi\Attributes as OA; -// +#[OA\Schema( + schema: "SummitProposedScheduleSummitEvent", + 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: "start_date", type: "integer", description: "Unix timestamp", example: 1640995200), + new OA\Property(property: "end_date", type: "integer", description: "Unix timestamp", example: 1641081600), + new OA\Property(property: "duration", type: "integer", description: "Duration in seconds", example: 3600), + ], + anyOf: [ + new OA\Property(property: "schedule_id", type: "integer", example: 1), + new OA\Property(property: "schedule", type: "SummitProposedSchedule"), + new OA\Property(property: "summit_event_id", type: "integer", example: 100), + new OA\Property(property: "summit_event", type: "SummitEvent"), + new OA\Property(property: "location_id", type: "integer", example: 10), + new OA\Property(property: "location", type: "SummitAbstractLocation"), + new OA\Property(property: "created_by_id", type: "integer", example: 5), + new OA\Property(property: "created_by", type: "Member"), + new OA\Property(property: "updated_by_id", type: "integer", example: 5, nullable: true), + new OA\Property(property: "updated_by", type: "Member"), + ] +)] +class SummitProposedScheduleSummitEvent {} + +#[OA\Schema( + schema: "SummitProposedSchedulePublishRequest", + required: ["start_date", "end_date", "location_id"], + properties: [ + new OA\Property(property: "start_date", type: "integer", description: "Unix timestamp", example: 1640995200), + new OA\Property(property: "end_date", type: "integer", description: "Unix timestamp (must be after start_date)", example: 1641081600), + new OA\Property(property: "duration", type: "integer", description: "Duration in seconds", example: 3600), + ], + anyOf: [ + new OA\Property(property: "location_id", type: "integer", example: 10), + new OA\Property(property: "location", type: "SummitAbstractLocation"), + ] +)] +class SummitProposedSchedulePublishRequest {} + +#[OA\Schema( + schema: "SummitProposedSchedulePublishAllRequest", + properties: [ + new OA\Property(property: "event_ids", type: "array", items: new OA\Items(type: "integer"), description: "Array of event IDs to publish") + ] +)] +class SummitProposedSchedulePublishAllRequest {} + +#[OA\Schema( + schema: "SummitProposedScheduleLock", + 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: "reason", type: "string", example: "Review in progress"), + ], + anyOf: [ + new OA\Property(property: "created_by_id", type: "integer", example: 5), + new OA\Property(property: "created_by", type: "Member"), + new OA\Property(property: "track_id", type: "integer", example: 3), + new OA\Property(property: "track", type: "PresentationCategory") + ] +)] +class SummitProposedScheduleLock {} + +#[OA\Schema( + schema: "SummitProposedScheduleLockRequest", + properties: [ + new OA\Property(property: "message", type: "string", maxLength: 1024, example: "Sending track schedule for review") + ] +)] +class SummitProposedScheduleLockRequest {} + +#[OA\Schema( + schema: "PaginatedSummitProposedScheduleSummitEventsResponse", + allOf: [ + new OA\Schema(ref: "#/components/schemas/PaginateDataSchemaResponse"), + new OA\Schema( + type: "object", + properties: [ + new OA\Property( + property: "data", + type: "array", + items: new OA\Items(ref: "#/components/schemas/SummitProposedScheduleSummitEvent") + ) + ] + ) + ] +)] +class PaginatedSummitProposedScheduleSummitEventsResponse {} + +#[OA\Schema( + schema: "PaginatedSummitProposedScheduleLocksResponse", + allOf: [ + new OA\Schema(ref: "#/components/schemas/PaginateDataSchemaResponse"), + new OA\Schema( + type: "object", + properties: [ + new OA\Property( + property: "data", + type: "array", + items: new OA\Items(ref: "#/components/schemas/SummitProposedScheduleLock") + ) + ] + ) + ] +)] +class PaginatedSummitProposedScheduleLocksResponse {} + +#[OA\Schema( + schema: "SummitProposedSchedulePublishAllResponse", + 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: "Review in progress"), + new OA\Property(property: "source", type: "string", example: "Google Calendar"), + new OA\Property(property: "summit_id", type: "integer", example: 3), + new OA\Property(property: "scheduled_summit_events", type: "array", items: new OA\Items(ref: "#/components/schemas/SummitProposedScheduleSummitEvent"), description: "Array of scheduled summit events, only available if it is added in expand."), + new OA\Property(property: "locks", type: "array", items: new OA\Items(ref: "#/components/schemas/SummitProposedScheduleLock")), + ], + anyOf: [ + new OA\Property(property: "created_by_id", type: "integer", example: 5), + new OA\Property(property: "created_by", type: "Member"), + ] +)] +class SummitProposedSchedulePublishAllResponse {}