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: make endpoint to create ratings #52

Merged
merged 6 commits into from
Mar 24, 2024
Merged

Conversation

anand2312
Copy link
Contributor

No description provided.

Copy link
Member

@vivekashok1221 vivekashok1221 left a 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.

src/backend/routers/post.py Show resolved Hide resolved
src/backend/routers/post.py Outdated Show resolved Hide resolved
"update": {"value": rating.rating},
},
)
except PrismaError as e:
Copy link
Member

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).

Copy link
Member

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")
Copy link
Member

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

Copy link
Member

@vivekashok1221 vivekashok1221 left a comment

Choose a reason for hiding this comment

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

lgtm

@vivekashok1221 vivekashok1221 merged commit b4639fa into main Mar 24, 2024
4 checks passed
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