-
Notifications
You must be signed in to change notification settings - Fork 56
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 #21
base: main
Are you sure you want to change the base?
Solution #21
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.
Thank you for your hard work on this pull request! 😊 There are a few critical issues that need to be addressed before we can approve it:
-
Schema Naming: The class names in
schemas/movies.py
are incorrect. They should be updated fromMovieShema
toMovieSchema
to follow standard naming conventions. This change needs to be reflected in all relevant import statements as well. -
Schema Naming Requirements: According to the task requirements, the schema classes should be named
MovieDetailResponseSchema
andMovieListResponseSchema
. Please update the class names to meet these requirements. -
Pagination Logic: The logic for determining the
next_page
URL should be reviewed. The conditionpage < 20
might not handle pagination correctly when the last page is reached. Consider usingpage < total_pages
to ensure thenext_page
URL is only generated when there are more pages available.
Once these issues are resolved, please run the provided tests to ensure everything works as expected. Keep up the great work, and feel free to reach out if you have any questions! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
src/routes/movies.py
Outdated
from fastapi import APIRouter, Depends, HTTPException, Query | ||
from schemas.movies import MoviesSchema, MovieShema |
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.
There is a typo in the import statement. MovieShema
should be MovieSchema
to follow standard naming conventions and avoid confusion.
src/routes/movies.py
Outdated
prev_page = f"/theater/movies/?page={page - 1}&per_page={per_page}" | ||
|
||
next_page = None | ||
if page < 20 and total_items > count: |
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 condition page < 20
might not correctly handle the case when the last page is reached. Consider using page < total_pages
to ensure the next_page
URL is only generated when there are more pages available.
src/schemas/movies.py
Outdated
from sqlalchemy import DECIMAL | ||
|
||
|
||
class MovieShema(BaseModel): |
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.
There is a typo in the class name MovieShema
. It should be MovieSchema
to follow standard naming conventions and avoid confusion.
src/schemas/movies.py
Outdated
|
||
|
||
class MoviesSchema(BaseModel): | ||
movies: list[MovieShema] |
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.
After correcting the class name to MovieSchema
, ensure that this reference is also updated to list[MovieSchema]
.
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.
Review Summary
Great effort on your submission! 🎉 While your code is on the right track, there are a few important changes needed to fully meet the task requirements:
-
Schema Naming:
- The class names in
schemas/movies.py
should be updated fromMoviesSchema
andMovieSchema
toMovieListResponseSchema
andMovieDetailResponseSchema
, respectively. - Ensure that all relevant import statements reflect these changes to maintain consistency across your codebase.
- The class names in
-
Pagination Logic:
- The logic for determining the
next_page
URL is correctly implemented usingpage < total_pages
, which aligns with the task requirements. Well done on this part! 👍
- The logic for determining the
Although these naming issues are critical for the functionality of the code, the decision to approve your Pull Request is made to help you move forward with your learning. Please address these issues in your next iteration to avoid similar problems in the future. Keep up the good work and continue improving your code! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
from fastapi import APIRouter, Depends, HTTPException, Query | ||
from schemas.movies import MoviesSchema, MovieSchema |
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 import statement should be updated to import MovieDetailResponseSchema
and MovieListResponseSchema
instead of MoviesSchema
and MovieSchema
to match the task requirements.
from sqlalchemy import DECIMAL | ||
|
||
|
||
class MovieSchema(BaseModel): |
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 class name MovieSchema
should be updated to MovieDetailResponseSchema
to meet the task requirements.
country: str = Field(min_length=2, max_length=3) | ||
|
||
|
||
class MoviesSchema(BaseModel): |
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 class name MoviesSchema
should be updated to MovieListResponseSchema
to meet the task requirements.
No description provided.