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: Implement task #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: Implement task #14

wants to merge 2 commits into from

Conversation

sumseer
Copy link

@sumseer sumseer commented Jan 21, 2025

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 on implementing the task requirements! 🎉 Your code is well-structured and meets the core functionality needed for the project. While there are some minor areas for improvement, such as providing more specific error messages and considering default values for optional fields, these do not impact the overall functionality. Keep up the good work, and consider these suggestions for future enhancements to make your code even more robust and user-friendly! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

@@ -139,6 +146,7 @@ def seed(self):
print(f"Unexpected error: {e}")

Choose a reason for hiding this comment

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

Similar to the SQLAlchemyError, consider logging unexpected errors to a file or a logging system for better traceability.

total_pages = (total_items + per_page - 1) // per_page

if page > total_pages or total_items == 0:
raise HTTPException(status_code=404, detail="No movies found.")

Choose a reason for hiding this comment

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

Consider providing more specific feedback in the HTTPException message, such as indicating whether the issue is with the page number or if there are no movies at all.

if len(movie.name) > 255:
raise HTTPException(
status_code=400,
detail="Invalid input data."

Choose a reason for hiding this comment

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

The error message 'Invalid input data.' is quite generic. Consider specifying which field is invalid to provide better feedback to the client.

if movie.date > datetime.datetime.now().date() + datetime.timedelta(days=365):
raise HTTPException(
status_code=400,
detail="Invalid input data."

Choose a reason for hiding this comment

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

The error message 'Invalid input data.' is generic. Consider specifying that the 'date' field is invalid to provide better feedback to the client.

if not (0 <= movie.score <= 100):
raise HTTPException(
status_code=400,
detail="Invalid input data."

Choose a reason for hiding this comment

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

The error message 'Invalid input data.' is generic. Consider specifying that the 'score' field is invalid to provide better feedback to the client.

if not (0 <= movie.score <= 100):
raise HTTPException(
status_code=400,
detail="Invalid input data."

Choose a reason for hiding this comment

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

The error message 'Invalid input data.' is generic. Consider specifying that the 'score' field is invalid to provide better feedback to the client.

if movie.budget < 0:
raise HTTPException(
status_code=400,
detail="Invalid input data."

Choose a reason for hiding this comment

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

The error message 'Invalid input data.' is generic. Consider specifying that the 'budget' field is invalid to provide better feedback to the client.

if movie.revenue < 0:
raise HTTPException(
status_code=400,
detail="Invalid input data."

Choose a reason for hiding this comment

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

The error message 'Invalid input data.' is generic. Consider specifying that the 'revenue' field is invalid to provide better feedback to the client.

class CountryResponseSchema(BaseModel):
id: int
code: str
name: str | None

Choose a reason for hiding this comment

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

Consider providing a default value for the 'name' field in the CountryResponseSchema to ensure consistency and avoid potential issues when the field is not provided.

Comment on lines +89 to +95
name: str | None = None
date: datetime.date | None = None
score: float | None = None
overview: str | None = None
status: MovieStatusEnum | None = None
budget: float | None = None
revenue: float | None = None

Choose a reason for hiding this comment

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

Ensure that the optional fields in MovieUpdateResponseSchema have appropriate default values. Currently, they are set to None, which is fine, but make sure this aligns with the application's logic and requirements.

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