-
Notifications
You must be signed in to change notification settings - Fork 43
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
Solution #2
base: main
Are you sure you want to change the base?
Solution #2
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.
Great job! 🎉 Your code meets all the task requirements and constraints perfectly. The schemas, endpoints, and error handling are all well-implemented, and your attention to detail ensures the API functions as expected. Keep up the excellent work! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
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.
Your implementation meets the core requirements of the task, and the code is well-structured and functional. 🎉 There are minor issues related to the base URL for pagination links and the use of model_validate
, but these do not critically impact the functionality. Consider addressing these in future iterations for improved accuracy and adherence to best practices. Keep up the great work! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
offset = (page - 1) * per_page | ||
movies_query = db.query(MovieModel).offset(offset).limit(per_page).all() | ||
movies = [MovieDetailResponseSchema.model_validate(movie) for movie in movies_query] |
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.
The method model_validate
is not a standard method for Pydantic models. You might want to use MovieDetailResponseSchema.from_orm(movie)
if MovieDetailResponseSchema
is configured with orm_mode = True
in its Config class. This will allow you to convert SQLAlchemy model instances to Pydantic models.
movies_query = db.query(MovieModel).offset(offset).limit(per_page).all() | ||
movies = [MovieDetailResponseSchema.model_validate(movie) for movie in movies_query] | ||
|
||
base_url = "/theater/movies/" |
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.
The base URL for pagination links should match the prefix used in the main application router setup. Since the router is included with the prefix /api/v1/theater
, the base URL should be /api/v1/theater/movies/
to ensure the pagination links are correct.
No description provided.