Skip to content
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

feat: voting API #2419

Merged
merged 36 commits into from
Aug 28, 2024
Merged

feat: voting API #2419

merged 36 commits into from
Aug 28, 2024

Conversation

lbiedinger
Copy link
Member

@lbiedinger lbiedinger commented Aug 13, 2024

  • refactor Express API handlers to use single error handler registered as final middleware
  • refactor Express API events handlers to be exported as a single router from packages/portal/src/server-middlware/api/events/index.js
  • move postgres client helpers for Express API events handlers up the directory hierarchy to be used by other handlers
  • introduce a Keycloak client helper for Express API events handlers requiring authorization via Keycloak
  • introduce Express API polls handlers for creating, retrieving and deleting votes, exported as a single router from packages/portal/src/server-middlware/api/polls/index.js
  • register the polls router at /_api/votes for routes:
    • GET /_api/votes -- fetch votes by external candidate ID, and optional voter if authorization header present
    • PUT /_api/votes/:externalCandidateId -- create a vote for a candidate, scoped to the currently authorized user
    • DELETE /_api/votes/:externalCandidateId -- delete a vote for a candidate, scoped to the currently authorized user
  • make FeatureIdeas use the new polls API, passing authorization header on to it, and refreshing access tokens if a 401 response is received

Copy link

JIRA ticket: EC-6893

@rwd rwd marked this pull request as ready for review August 22, 2024 06:26
Copy link

Preview deployment: https://pr-2419.portal-js.dev.eanadev.org/

@rwd rwd changed the title feat: voting API, votes and retrieval feat: voting API Aug 22, 2024
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
74.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@lbiedinger lbiedinger merged commit 1c5b57d into master Aug 28, 2024
15 of 17 checks passed
@lbiedinger lbiedinger deleted the feat/EC-6893-feature-vote-api branch August 28, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants