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
Expand Up @@ -15,9 +15,11 @@
use App\Models\Foundation\Summit\Events\Presentations\PresentationCategoryGroupConstants;
use App\Models\Foundation\Summit\Repositories\IPresentationCategoryGroupRepository;
use App\Services\Model\IPresentationCategoryGroupService;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use OpenApi\Attributes as OA;
use libs\utils\PaginationValidationRules;
use models\exceptions\ValidationException;
use models\oauth2\IResourceServerContext;
Expand Down Expand Up @@ -71,6 +73,32 @@ public function __construct
* @param $summit_id
* @return mixed
*/
#[OA\Get(
path: '/api/v1/summits/{id}/track-groups',
summary: 'Get all track groups by summit',
description: 'Returns a paginated list of track groups (presentation category groups) for a summit',
tags: ['track-groups'],
security: [['Bearer' => []]],
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)),
new OA\Parameter(name: 'per_page', in: 'query', required: false, schema: new OA\Schema(type: 'integer', default: 5)),
new OA\Parameter(name: 'filter', in: 'query', required: false, description: 'Filter by name, description, slug, track_title, track_code, group_title, group_code, voting_visible, chair_visible, or class_name', schema: new OA\Schema(type: 'string')),
new OA\Parameter(name: 'order', in: 'query', required: false, description: 'Order by id, name, or slug', schema: new OA\Schema(type: 'string')),
new OA\Parameter(name: 'expand', in: 'query', required: false, description: 'Expand relations (tracks)', schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/PaginatedPresentationCategoryGroupsResponse')
),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 getAllBySummit($summit_id){
$values = Request::all();
$rules = PaginationValidationRules::get();
Expand Down Expand Up @@ -290,6 +318,29 @@ public function getAllBySummitCSV($summit_id){
* @param $track_group_id
* @return mixed
*/
#[OA\Get(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}',
summary: 'Get a track group by id',
description: 'Returns a single track group by id',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group id'),
new OA\Parameter(name: 'expand', in: 'query', required: false, description: 'Expand relations (tracks)', schema: new OA\Schema(type: 'string')),
],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'Success',
content: new OA\JsonContent(ref: '#/components/schemas/PresentationCategoryGroup')
),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 getTrackGroupBySummit($summit_id, $track_group_id){
try {
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
Expand Down Expand Up @@ -318,6 +369,33 @@ public function getTrackGroupBySummit($summit_id, $track_group_id){
* @param $track_group_id
* @return mixed
*/
#[OA\Put(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}',
summary: 'Update a track group',
description: 'Updates an existing track group',
tags: ['track-groups'],
security: [['Bearer' => []]],
requestBody: new OA\RequestBody(
required: true,
content: new OA\JsonContent(ref: '#/components/schemas/PresentationCategoryGroupRequest')
),
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group id'),
],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'Track Group Updated',
content: new OA\JsonContent(ref: '#/components/schemas/PresentationCategoryGroup')
),
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_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 updateTrackGroupBySummit($summit_id, $track_group_id){
try {

Expand Down Expand Up @@ -364,6 +442,24 @@ public function updateTrackGroupBySummit($summit_id, $track_group_id){
* @param $track_group_id
* @return mixed
*/
#[OA\Delete(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}',
summary: 'Delete a track group',
description: 'Deletes a track group',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group id'),
],
responses: [
new OA\Response(response: Response::HTTP_NO_CONTENT, description: 'Track Group Deleted'),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 deleteTrackGroupBySummit($summit_id, $track_group_id){
try {

Expand Down Expand Up @@ -393,6 +489,32 @@ public function deleteTrackGroupBySummit($summit_id, $track_group_id){
* @param $summit_id
* @return mixed
*/
#[OA\Post(
path: '/api/v1/summits/{id}/track-groups',
summary: 'Create a new track group',
description: 'Creates a new track group for a summit',
tags: ['track-groups'],
security: [['Bearer' => []]],
requestBody: new OA\RequestBody(
required: true,
content: new OA\JsonContent(ref: '#/components/schemas/PresentationCategoryGroupRequest')
),
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
],
responses: [
new OA\Response(
response: Response::HTTP_CREATED,
description: 'Track Group Created',
content: new OA\JsonContent(ref: '#/components/schemas/PresentationCategoryGroup')
),
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_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 addTrackGroupBySummit($summit_id){
try {

Expand Down Expand Up @@ -440,6 +562,25 @@ public function addTrackGroupBySummit($summit_id){
* @param $track_id
* @return mixed
*/
#[OA\Put(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}/tracks/{track_id}',
summary: 'Associate a track to a track group',
description: 'Associates a presentation category (track) to a track group',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group 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: Response::HTTP_OK, description: 'Track Associated'),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 associateTrack2TrackGroup($summit_id, $track_group_id, $track_id){
try {

Expand Down Expand Up @@ -471,6 +612,25 @@ public function associateTrack2TrackGroup($summit_id, $track_group_id, $track_id
* @param $track_id
* @return mixed
*/
#[OA\Delete(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}/tracks/{track_id}',
summary: 'Disassociate a track from a track group',
description: 'Removes the association between a presentation category (track) and a track group',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group 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: Response::HTTP_NO_CONTENT, description: 'Track Disassociated'),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 disassociateTrack2TrackGroup($summit_id, $track_group_id, $track_id){
try {

Expand Down Expand Up @@ -502,6 +662,25 @@ public function disassociateTrack2TrackGroup($summit_id, $track_group_id, $track
* @param $group_id
* @return mixed
*/
#[OA\Put(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}/allowed-groups/{group_id}',
summary: 'Associate an allowed group to a track group',
description: 'Associates a group to the list of allowed groups for a private track group',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group id'),
new OA\Parameter(name: 'group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The group id'),
],
responses: [
new OA\Response(response: Response::HTTP_OK, description: 'Group Associated'),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 associateAllowedGroup2TrackGroup($summit_id, $track_group_id, $group_id){
try {

Expand Down Expand Up @@ -533,6 +712,25 @@ public function associateAllowedGroup2TrackGroup($summit_id, $track_group_id, $g
* @param $group_id
* @return mixed
*/
#[OA\Delete(
path: '/api/v1/summits/{id}/track-groups/{track_group_id}/allowed-groups/{group_id}',
summary: 'Disassociate an allowed group from a track group',
description: 'Removes a group from the list of allowed groups for a private track group',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
new OA\Parameter(name: 'track_group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The track group id'),
new OA\Parameter(name: 'group_id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The group id'),
],
responses: [
new OA\Response(response: Response::HTTP_NO_CONTENT, description: 'Group Disassociated'),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 disassociateAllowedGroup2TrackGroup($summit_id, $track_group_id, $group_id){
try {

Expand Down Expand Up @@ -562,6 +760,31 @@ public function disassociateAllowedGroup2TrackGroup($summit_id, $track_group_id,
* @param $summit_id
* @return mixed
*/
#[OA\Get(
path: '/api/v1/summits/{id}/track-groups/metadata',
summary: 'Get track groups metadata',
description: 'Returns metadata about available track group types',
tags: ['track-groups'],
security: [['Bearer' => []]],
parameters: [
new OA\Parameter(name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), description: 'The summit id'),
],
responses: [
new OA\Response(
response: Response::HTTP_OK,
description: 'Success',
content: new OA\JsonContent(
type: 'object',
properties: [
new OA\Property(property: 'class_names', type: 'array', items: new OA\Items(type: 'string')),
]
)
),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
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 getMetadata($summit_id){
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
if (is_null($summit)) return $this->error404();
Expand All @@ -571,4 +794,4 @@ public function getMetadata($summit_id){
$this->repository->getMetadata($summit)
);
}
}
}
Loading