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

Solution #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Solution #2

wants to merge 1 commit into from

Conversation

VladyslavBon
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! ✨

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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]

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/"

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.

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