Closed serbanlex closed 11 months ago
GET /vote/{id}
Vote
POST /vote
VoteModel
PATCH /vote/{id}
positive: bool
positive
DELETE /vote/{id}
Consider refactoring the common code to the service package, in a votes.py file.
service
votes.py
GET /vote/{id}
-> gets a vote from theVote
table, querying by idPOST /vote
-> uses a Pydantic model,VoteModel
, that should match everything from the DB model besides the ID (which will be autoincremented anyway)PATCH /vote/{id}
-> this should only modify thepositive: bool
attribute, use a query param for this (something likepositive
DELETE /vote/{id}
-> deletes the vote by ID, with appropriate checks that it exists.Consider refactoring the common code to the
service
package, in avotes.py
file.