Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace App\Http\Controllers;
<?php

namespace App\Http\Controllers;

/**
* Copyright 2018 OpenStack Foundation
Expand All @@ -15,6 +17,7 @@
use App\Http\Utils\BooleanCellFormatter;
use App\Http\Utils\EpochCellFormatter;
use App\Models\Foundation\Summit\Repositories\IPresentationSpeakerSummitAssistanceConfirmationRequestRepository;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Validator;
Expand All @@ -25,6 +28,7 @@
use models\summit\ISpeakerRepository;
use models\summit\ISummitRepository;
use ModelSerializers\SerializerRegistry;
use OpenApi\Attributes as OA;
use services\model\ISpeakerService;
use utils\FilterParser;
use utils\OrderParser;
Expand Down Expand Up @@ -77,6 +81,65 @@ public function __construct
* @param $summit_id
* @return mixed
*/
#[OA\Get(
path: "/api/v1/summits/{id}/speakers-assistances",
summary: "Get all speaker assistances for a summit",
security: [["Bearer" => []]],
tags: ["summit-speakers-assistances"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "page",
in: "query",
required: false,
schema: new OA\Schema(type: "integer", default: 1),
description: "Page number"
),
new OA\Parameter(
name: "per_page",
in: "query",
required: false,
schema: new OA\Schema(type: "integer", default: 10),
description: "Items per page"
),
new OA\Parameter(
name: "filter",
in: "query",
description: "Filter query. Available operators: id==, on_site_phone==/=@, speaker_email==/=@, speaker==/=@, is_confirmed==, registered==, confirmation_date>/</>=/<= (epoch)",
schema: new OA\Schema(type: "string")
),
new OA\Parameter(
name: "order",
in: "query",
description: "Order by field. Available fields: id, is_confirmed, confirmation_date, created, registered",
schema: new OA\Schema(type: "string")
),
new OA\Parameter(
name: "expand",
in: "query",
description: "Comma-separated list of relations to expand. Available: speaker",
schema: new OA\Schema(type: "string")
)
],
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedPresentationSpeakerSummitAssistanceConfirmationRequestsResponse")
),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function getBySummit($summit_id)
{
try {
Expand Down Expand Up @@ -162,6 +225,45 @@ public function getBySummit($summit_id)
* @param $summit_id
* @return mixed
*/
#[OA\Get(
path: "/api/v1/summits/{id}/speakers-assistances/csv",
summary: "Export speaker assistances to CSV",
security: [["Bearer" => []]],
tags: ["summit-speakers-assistances"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "filter",
in: "query",
description: "Filter query. Available operators: id==, on_site_phone==/=@, speaker_email==/=@, speaker==/=@, is_confirmed==, registered==, confirmation_date>/</>=/<= (epoch)",
schema: new OA\Schema(type: "string")
),
new OA\Parameter(
name: "order",
in: "query",
description: "Order by field. Available fields: id, is_confirmed, confirmation_date, created, registered",
schema: new OA\Schema(type: "string")
)
],
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\MediaType(mediaType: "text/csv", schema: new OA\Schema(type: "string"))
),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function getBySummitCSV($summit_id){
try {
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
Expand Down Expand Up @@ -236,6 +338,41 @@ public function getBySummitCSV($summit_id){
* @param $summit_id
* @return mixed
*/
#[OA\Post(
path: "/api/v1/summits/{id}/speakers-assistances",
summary: "Create a speaker assistance confirmation request",
security: [["Bearer" => []]],
tags: ["summit-speakers-assistances"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
)
],
requestBody: new OA\RequestBody(
required: true,
content: new OA\MediaType(
mediaType: "application/json",
schema: new OA\Schema(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequestCreateRequest")
)
),
responses: [
new OA\Response(
response: 201,
description: "Created",
content: new OA\JsonContent(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function addSpeakerSummitAssistance($summit_id)
{
try {
Expand Down Expand Up @@ -288,6 +425,48 @@ public function addSpeakerSummitAssistance($summit_id)
* @param $assistance_id
* @return mixed
*/
#[OA\Put(
path: "/api/v1/summits/{id}/speakers-assistances/{assistance_id}",
summary: "Update a speaker assistance confirmation request",
security: [["Bearer" => []]],
tags: ["summit-speakers-assistances"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "assistance_id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The assistance id"
)
],
requestBody: new OA\RequestBody(
required: true,
content: new OA\MediaType(
mediaType: "application/json",
schema: new OA\Schema(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequestUpdateRequest")
)
),
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function updateSpeakerSummitAssistance($summit_id, $assistance_id)
{
try {
Expand Down Expand Up @@ -340,6 +519,36 @@ public function updateSpeakerSummitAssistance($summit_id, $assistance_id)
* @param $assistance_id
* @return mixed
*/
#[OA\Delete(
path: "/api/v1/summits/{id}/speakers-assistances/{assistance_id}",
summary: "Delete a speaker assistance confirmation request",
security: [["Bearer" => []]],
tags: ["summit-speakers-assistances"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "assistance_id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The assistance id"
)
],
responses: [
new OA\Response(response: 204, description: "No Content"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function deleteSpeakerSummitAssistance($summit_id, $assistance_id)
{
try {
Expand Down Expand Up @@ -368,6 +577,46 @@ public function deleteSpeakerSummitAssistance($summit_id, $assistance_id)
* @param $assistance_id
* @return mixed
*/
#[OA\Get(
path: "/api/v1/summits/{id}/speakers-assistances/{assistance_id}",
summary: "Get a speaker assistance confirmation request by id",
security: [["Bearer" => []]],
tags: ["summit-speakers-assistances"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "assistance_id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The assistance id"
),
new OA\Parameter(
name: "expand",
in: "query",
description: "Comma-separated list of relations to expand. Available: speaker",
schema: new OA\Schema(type: "string")
)
],
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest")
),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Not Found"),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function getSpeakerSummitAssistanceBySummit($summit_id, $assistance_id)
{
try {
Expand Down Expand Up @@ -398,4 +647,4 @@ public function getSpeakerSummitAssistanceBySummit($summit_id, $assistance_id)
}
}

}
}
77 changes: 77 additions & 0 deletions app/Swagger/SummitPresentationSchemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,81 @@

use OpenApi\Attributes as OA;

// Summit Speaker Assistance Schemas

#[OA\Schema(
schema: "PresentationSpeakerSummitAssistanceConfirmationRequest",
type: "object",
properties: [
new OA\Property(property: "id", type: "integer", example: 1),
new OA\Property(property: "created", type: "integer", description: "Unix timestamp", example: 1640995200),
new OA\Property(property: "last_edited", type: "integer", description: "Unix timestamp", example: 1640995200),
new OA\Property(property: "on_site_phone", type: "string", nullable: true),
new OA\Property(property: "registered", type: "boolean"),
new OA\Property(property: "is_confirmed", type: "boolean"),
new OA\Property(property: "checked_in", type: "boolean"),
new OA\Property(property: "summit_id", type: "integer"),
new OA\Property(property: "speaker_email", type: "string"),
new OA\Property(property: "speaker_full_name", type: "string"),
new OA\Property(property: "confirmation_date", type: "integer", nullable: true),
],
anyOf:[
new OA\Property(property: "speaker_id", type: "integer"),
new OA\Property(property: "speaker", type: "PresentationSpeaker"),
]
)]
class PresentationSpeakerSummitAssistanceConfirmationRequest
{
}

#[OA\Schema(
schema: "PaginatedPresentationSpeakerSummitAssistanceConfirmationRequestsResponse",
allOf: [
new OA\Schema(ref: "#/components/schemas/PaginateDataSchemaResponse"),
new OA\Schema(
properties: [
new OA\Property(
property: "data",
type: "array",
items: new OA\Items(ref: "#/components/schemas/PresentationSpeakerSummitAssistanceConfirmationRequest")
)
]
)
]
)]
class PaginatedPresentationSpeakerSummitAssistanceConfirmationRequestsResponse
{
}

#[OA\Schema(
schema: "PresentationSpeakerSummitAssistanceConfirmationRequestCreateRequest",
type: "object",
required: ["speaker_id"],
properties: [
new OA\Property(property: "speaker_id", type: "integer"),
new OA\Property(property: "on_site_phone", type: "string", maxLength: 50),
new OA\Property(property: "registered", type: "boolean"),
new OA\Property(property: "is_confirmed", type: "boolean"),
new OA\Property(property: "checked_in", type: "boolean")
]
)]
class PresentationSpeakerSummitAssistanceConfirmationRequestCreateRequest
{
}

#[OA\Schema(
schema: "PresentationSpeakerSummitAssistanceConfirmationRequestUpdateRequest",
type: "object",
properties: [
new OA\Property(property: "on_site_phone", type: "string", maxLength: 50),
new OA\Property(property: "registered", type: "boolean"),
new OA\Property(property: "is_confirmed", type: "boolean"),
new OA\Property(property: "checked_in", type: "boolean")
]
)]
class PresentationSpeakerSummitAssistanceConfirmationRequestUpdateRequest
{
}

//