|
13 | 13 | **/ |
14 | 14 |
|
15 | 15 | use App\ModelSerializers\IMemberSerializerTypes; |
| 16 | +use App\Models\Foundation\Main\IGroup; |
| 17 | +use App\Security\SummitScopes; |
16 | 18 | use Illuminate\Support\Facades\Request; |
17 | 19 | use models\main\IMemberRepository; |
18 | 20 | use models\oauth2\IResourceServerContext; |
|
21 | 23 | use utils\Filter; |
22 | 24 | use utils\FilterParser; |
23 | 25 | use utils\PagingInfo; |
| 26 | +use OpenApi\Attributes as OA; |
| 27 | +use Symfony\Component\HttpFoundation\Response; |
24 | 28 |
|
25 | 29 | /** |
26 | 30 | * Class OAuth2SummitSubmittersApiController |
@@ -66,10 +70,72 @@ public function __construct |
66 | 70 | $this->service = $service; |
67 | 71 | } |
68 | 72 |
|
69 | | - /** |
70 | | - * @param $summit_id |
71 | | - * @return \Illuminate\Http\JsonResponse|mixed |
72 | | - */ |
| 73 | + #[OA\Get( |
| 74 | + path: "/api/v1/summits/{id}/submitters", |
| 75 | + summary: "Get all submitters for a summit", |
| 76 | + operationId: "getSubmittersBySummit", |
| 77 | + tags: ["SummitSubmitters"], |
| 78 | + security: [['summit_submitters_oauth2' => [ |
| 79 | + SummitScopes::ReadSummitData, |
| 80 | + SummitScopes::ReadAllSummitData, |
| 81 | + ]]], |
| 82 | + parameters: [ |
| 83 | + new OA\Parameter( |
| 84 | + name: "id", |
| 85 | + in: "path", |
| 86 | + required: true, |
| 87 | + description: "Summit ID or slug", |
| 88 | + schema: new OA\Schema(type: "string") |
| 89 | + ), |
| 90 | + new OA\Parameter( |
| 91 | + name: "page", |
| 92 | + in: "query", |
| 93 | + required: false, |
| 94 | + description: "Page number", |
| 95 | + schema: new OA\Schema(type: "integer", default: 1) |
| 96 | + ), |
| 97 | + new OA\Parameter( |
| 98 | + name: "per_page", |
| 99 | + in: "query", |
| 100 | + required: false, |
| 101 | + description: "Items per page", |
| 102 | + schema: new OA\Schema(type: "integer", default: 10) |
| 103 | + ), |
| 104 | + new OA\Parameter( |
| 105 | + name: "filter", |
| 106 | + in: "query", |
| 107 | + required: false, |
| 108 | + description: "Filter query (supports multiple operators)", |
| 109 | + schema: new OA\Schema(type: "string", example: "first_name=@John") |
| 110 | + ), |
| 111 | + new OA\Parameter( |
| 112 | + name: "order", |
| 113 | + in: "query", |
| 114 | + required: false, |
| 115 | + description: "Order by field (prefix with - for descending)", |
| 116 | + schema: new OA\Schema(type: "string", example: "first_name,-created") |
| 117 | + ), |
| 118 | + new OA\Parameter( |
| 119 | + name: "expand", |
| 120 | + in: "query", |
| 121 | + required: false, |
| 122 | + description: "Expand relations (presentations, member)", |
| 123 | + schema: new OA\Schema(type: "string", example: "presentations,member") |
| 124 | + ), |
| 125 | + ], |
| 126 | + responses: [ |
| 127 | + new OA\Response( |
| 128 | + response: Response::HTTP_OK, |
| 129 | + description: "Successful response with paginated submitters", |
| 130 | + content: new OA\JsonContent(ref: '#/components/schemas/PaginatedSubmittersResponse') |
| 131 | + ), |
| 132 | + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), |
| 133 | + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), |
| 134 | + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), |
| 135 | + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), |
| 136 | + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), |
| 137 | + ] |
| 138 | + )] |
73 | 139 | public function getAllBySummit($summit_id) |
74 | 140 | { |
75 | 141 | $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find(intval($summit_id)); |
@@ -158,10 +224,62 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit) { |
158 | 224 | ); |
159 | 225 | } |
160 | 226 |
|
161 | | - /** |
162 | | - * @param $summit_id |
163 | | - * @return \Illuminate\Http\JsonResponse|mixed |
164 | | - */ |
| 227 | + #[OA\Get( |
| 228 | + path: "/api/v1/summits/{id}/submitters/csv", |
| 229 | + description: "required-groups " . IGroup::SummitAdministrators . ", " . IGroup::SuperAdmins . ", " . IGroup::Administrators, |
| 230 | + summary: "Get all submitters for a summit in CSV format", |
| 231 | + operationId: "getSubmittersCSV", |
| 232 | + tags: ["SummitSubmitters"], |
| 233 | + security: [['summit_submitters_oauth2' => [ |
| 234 | + SummitScopes::ReadSummitData, |
| 235 | + SummitScopes::ReadAllSummitData, |
| 236 | + ]]], |
| 237 | + x: [ |
| 238 | + 'required-groups' => [ |
| 239 | + IGroup::SummitAdministrators, |
| 240 | + IGroup::SuperAdmins, |
| 241 | + IGroup::Administrators, |
| 242 | + ] |
| 243 | + ], |
| 244 | + parameters: [ |
| 245 | + new OA\Parameter( |
| 246 | + name: "id", |
| 247 | + in: "path", |
| 248 | + required: true, |
| 249 | + description: "Summit ID or slug", |
| 250 | + schema: new OA\Schema(type: "string") |
| 251 | + ), |
| 252 | + new OA\Parameter( |
| 253 | + name: "filter", |
| 254 | + in: "query", |
| 255 | + required: false, |
| 256 | + description: "Filter query to select specific submitters", |
| 257 | + schema: new OA\Schema(type: "string", example: "first_name=@John") |
| 258 | + ), |
| 259 | + new OA\Parameter( |
| 260 | + name: "order", |
| 261 | + in: "query", |
| 262 | + required: false, |
| 263 | + description: "Order by field (prefix with - for descending)", |
| 264 | + schema: new OA\Schema(type: "string", example: "first_name,-created") |
| 265 | + ), |
| 266 | + ], |
| 267 | + responses: [ |
| 268 | + new OA\Response( |
| 269 | + response: Response::HTTP_OK, |
| 270 | + description: "CSV file with submitter data", |
| 271 | + content: new OA\MediaType( |
| 272 | + mediaType: "text/csv", |
| 273 | + schema: new OA\Schema(type: "string", format: "binary") |
| 274 | + ) |
| 275 | + ), |
| 276 | + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), |
| 277 | + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), |
| 278 | + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), |
| 279 | + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), |
| 280 | + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), |
| 281 | + ] |
| 282 | + )] |
165 | 283 | public function getAllBySummitCSV($summit_id) |
166 | 284 | { |
167 | 285 | $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find(intval($summit_id)); |
@@ -255,10 +373,57 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit) { |
255 | 373 | ); |
256 | 374 | } |
257 | 375 |
|
258 | | - /** |
259 | | - * @param $summit_id |
260 | | - * @return \Illuminate\Http\JsonResponse|mixed |
261 | | - */ |
| 376 | + #[OA\Put( |
| 377 | + path: "/api/v1/summits/{id}/submitters/all/send", |
| 378 | + description: "required-groups " . IGroup::SummitAdministrators . ", " . IGroup::SuperAdmins . ", " . IGroup::Administrators . ", " . IGroup::SummitRegistrationAdmins, |
| 379 | + summary: "Send bulk emails to submitters", |
| 380 | + operationId: "sendSubmittersBulkEmails", |
| 381 | + tags: ["SummitSubmitters"], |
| 382 | + security: [['summit_submitters_oauth2' => [ |
| 383 | + SummitScopes::WriteSummitData, |
| 384 | + SummitScopes::WriteSpeakersData, |
| 385 | + ]]], |
| 386 | + x: [ |
| 387 | + 'required-groups' => [ |
| 388 | + IGroup::SummitAdministrators, |
| 389 | + IGroup::SuperAdmins, |
| 390 | + IGroup::Administrators, |
| 391 | + IGroup::SummitRegistrationAdmins, |
| 392 | + ] |
| 393 | + ], |
| 394 | + parameters: [ |
| 395 | + new OA\Parameter( |
| 396 | + name: "id", |
| 397 | + in: "path", |
| 398 | + required: true, |
| 399 | + description: "Summit ID or slug", |
| 400 | + schema: new OA\Schema(type: "string") |
| 401 | + ), |
| 402 | + new OA\Parameter( |
| 403 | + name: "filter", |
| 404 | + in: "query", |
| 405 | + required: false, |
| 406 | + description: "Filter query to select specific submitters", |
| 407 | + schema: new OA\Schema(type: "string", example: "has_accepted_presentations==true") |
| 408 | + ), |
| 409 | + ], |
| 410 | + requestBody: new OA\RequestBody( |
| 411 | + required: true, |
| 412 | + content: new OA\JsonContent(ref: "#/components/schemas/SendSubmittersEmailsRequest") |
| 413 | + ), |
| 414 | + responses: [ |
| 415 | + new OA\Response( |
| 416 | + response: Response::HTTP_OK, |
| 417 | + description: "Emails sent successfully" |
| 418 | + ), |
| 419 | + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"), |
| 420 | + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), |
| 421 | + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), |
| 422 | + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit not found"), |
| 423 | + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), |
| 424 | + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), |
| 425 | + ] |
| 426 | + )] |
262 | 427 | public function send($summit_id) |
263 | 428 | { |
264 | 429 | return $this->processRequest(function () use ($summit_id) { |
|
0 commit comments