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

update save votes endpoint #189

Merged
merged 9 commits into from
Feb 20, 2024
Merged

Conversation

diegoalzate
Copy link
Contributor

closes #184

overview

accept saving votes as an array of votes you want to save, this will help the frontend not have to loop over changes and just be able to send everything in one request

breaking api changes

  • moved save vote to /cycles router
  • moved get votes to /cycles router
  • deleted votes router

The reason why it was moved there it made more sense in hierarchy

function overviews

  • saveVotes: handles the req.body and sends it to children functions
  • updateVoteCount: runs plural score calculation
  • validateAndSaveVote: checks required fields and saves the new vote in db

@diegoalzate diegoalzate added the feature New feature or request label Feb 19, 2024
@diegoalzate diegoalzate self-assigned this Feb 19, 2024
@diegoalzate diegoalzate changed the base branch from main to develop February 19, 2024 21:48
@diegoalzate diegoalzate added minor A minor change is included in this PR patch A patch change is included in this PR and removed minor A minor change is included in this PR labels Feb 19, 2024
Copy link
Collaborator

@MartinBenediktBusch MartinBenediktBusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionaly I encounter the following error when hitting the Save All Votes button in the UI using this branch (in branch develop it works):

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api/users/0615974f-1517-41e9-a701-3950ea783c34/cycles/a0767d41-a775-4319-9705-e4eb882f7255/votes</pre>
</body>
</html>

Copy link
Collaborator

@MartinBenediktBusch MartinBenediktBusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! What I also like about this PR is that we seperate thequite complex former saveVote function into smaller more managable parts.

@diegoalzate diegoalzate added minor A minor change is included in this PR and removed patch A patch change is included in this PR labels Feb 20, 2024
@diegoalzate diegoalzate merged commit ab200e1 into develop Feb 20, 2024
3 checks passed
@diegoalzate diegoalzate deleted the diego/update-save-votes-endpoint branch February 20, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request minor A minor change is included in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update votes endpoint to accept array
2 participants