-
Notifications
You must be signed in to change notification settings - Fork 2
feat(speakers): add unique activities count endpoints for speakers and submitters #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d9cf735
a224da8
ea0f4e5
9a80263
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,3 +40,4 @@ public/apc.php | |
| .nvmrc | ||
| .codegraph | ||
| docs/ | ||
| docker-compose.override.yml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -495,4 +495,111 @@ public function send($summit_id) | |
| return $this->ok(); | ||
| }); | ||
| } | ||
|
|
||
| #[OA\Get( | ||
| path: "/api/v1/summits/{id}/submitters/all/events/count", | ||
| summary: "Get unique activities count for submitters", | ||
| operationId: "getSubmittersActivitiesCount", | ||
| tags: ["Summit Submitters"], | ||
| security: [['summit_submitters_oauth2' => [ | ||
| SummitScopes::ReadSummitData, | ||
| SummitScopes::ReadAllSummitData, | ||
| ]]], | ||
| parameters: [ | ||
| new OA\Parameter( | ||
| name: "id", | ||
| in: "path", | ||
| required: true, | ||
| description: "Summit ID", | ||
| schema: new OA\Schema(type: "integer") | ||
| ), | ||
| new OA\Parameter( | ||
| name: "filter", | ||
| in: "query", | ||
| required: false, | ||
| description: "Filter query (supports multiple operators). Filterable fields: id, not_id, first_name, last_name, email, full_name, member_id, member_user_external_id, has_accepted_presentations, has_alternate_presentations, has_rejected_presentations, presentations_track_id, presentations_selection_plan_id, presentations_type_id, presentations_title, presentations_abstract, presentations_submitter_full_name, presentations_submitter_email, is_speaker, has_media_upload_with_type, has_not_media_upload_with_type.", | ||
| schema: new OA\Schema(type: "string", example: "has_accepted_presentations==true") | ||
| ), | ||
| ], | ||
| responses: [ | ||
| new OA\Response( | ||
| response: Response::HTTP_OK, | ||
| description: "Unique activities count", | ||
| content: new OA\JsonContent( | ||
| properties: [new OA\Property(property: "count", type: "integer")] | ||
| ) | ||
| ), | ||
| 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: "Summit not found"), | ||
| new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), | ||
| ] | ||
| )] | ||
| public function getSubmittersActivitiesCount($summit_id) | ||
| { | ||
| return $this->processRequest(function () use ($summit_id) { | ||
|
|
||
| $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find(intval($summit_id)); | ||
| if (is_null($summit)) return $this->error404(); | ||
|
|
||
| $filter = null; | ||
|
|
||
| if (Request::has('filter')) { | ||
| $filter = FilterParser::parse(Request::input('filter'), [ | ||
| 'id' => ['=='], | ||
| 'not_id' => ['=='], | ||
| 'first_name' => ['=@', '@@', '=='], | ||
| 'last_name' => ['=@', '@@', '=='], | ||
| 'email' => ['=@', '@@', '=='], | ||
| 'full_name' => ['=@', '@@', '=='], | ||
| 'member_id' => ['=='], | ||
| 'member_user_external_id' => ['=='], | ||
| 'has_accepted_presentations' => ['=='], | ||
| 'has_alternate_presentations' => ['=='], | ||
| 'has_rejected_presentations' => ['=='], | ||
| 'presentations_track_id' => ['=='], | ||
| 'presentations_selection_plan_id' => ['=='], | ||
| 'presentations_type_id' => ['=='], | ||
| 'presentations_title' => ['=@', '@@', '=='], | ||
| 'presentations_abstract' => ['=@', '@@', '=='], | ||
| 'presentations_submitter_full_name' => ['=@', '@@', '=='], | ||
| 'presentations_submitter_email' => ['=@', '@@', '=='], | ||
| 'is_speaker' => ['=='], | ||
| 'has_media_upload_with_type' => ['=='], | ||
| 'has_not_media_upload_with_type' => ['=='], | ||
| ]); | ||
| } | ||
|
|
||
| if (!is_null($filter)) { | ||
| $filter->validate([ | ||
| 'id' => 'sometimes|integer', | ||
| 'not_id' => 'sometimes|integer', | ||
| 'first_name' => 'sometimes|string', | ||
| 'last_name' => 'sometimes|string', | ||
| 'email' => 'sometimes|string', | ||
| 'full_name' => 'sometimes|string', | ||
| 'member_id' => 'sometimes|integer', | ||
| 'member_user_external_id' => 'sometimes|integer', | ||
| 'has_accepted_presentations' => 'sometimes|string|in:true,false', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mulldug The getSpeakersActivitiesCount validation rules for has_accepted_presentations, has_alternate_presentations, and has_rejected_presentations use sometimes|required|string|in:true,false, |
||
| 'has_alternate_presentations' => 'sometimes|string|in:true,false', | ||
| 'has_rejected_presentations' => 'sometimes|string|in:true,false', | ||
| 'presentations_track_id' => 'sometimes|integer', | ||
| 'presentations_selection_plan_id' => 'sometimes|integer', | ||
| 'presentations_type_id' => 'sometimes|integer', | ||
| 'presentations_title' => 'sometimes|string', | ||
| 'presentations_abstract' => 'sometimes|string', | ||
| 'presentations_submitter_full_name' => 'sometimes|string', | ||
| 'presentations_submitter_email' => 'sometimes|string', | ||
| 'is_speaker' => 'sometimes|string|in:true,false', | ||
| 'has_media_upload_with_type' => 'sometimes|integer', | ||
| 'has_not_media_upload_with_type' => 'sometimes|integer', | ||
| ]); | ||
| } | ||
|
|
||
| $count = $this->repository->getUniqueActivitiesCountBySummit($summit, $filter); | ||
|
|
||
| return $this->ok(['count' => $count]); | ||
| }); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/OpenStackweb/summit-api/pull/543/changes#r3357358197