-
Notifications
You must be signed in to change notification settings - Fork 1
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: make endpoint to create ratings #52
Conversation
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.
Untested but code looks functional. I will test once I get a chance.
"update": {"value": rating.rating}, | ||
}, | ||
) | ||
except PrismaError as e: |
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.
We should return a special error message for when the post ID is incorrect (currently we return a 500).
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.
Although the frontend will probably handle supplying the correct post_id, it would still be nice to have a proper response for when things might go wrong.
"""Get full details of a specific post.""" | ||
post = await Post.prisma().find_first( | ||
where={"id": id, "deleted": False}, include={"tags": True, "media": True, "author": True} | ||
where={"id": post_id, "deleted": False}, | ||
include={"tags": True, "media": True, "author": True}, | ||
) | ||
if not post: | ||
raise HTTPException(404, "Post not found") |
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.
id
needs to be changed to post_id
on line 111
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.
lgtm
No description provided.