-
Notifications
You must be signed in to change notification settings - Fork 58
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
base: main
Are you sure you want to change the base?
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 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}") |
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.
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.") |
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.
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." |
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 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." |
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 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." |
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 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." |
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 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." |
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 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." |
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 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 |
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.
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.
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 |
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.
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.
No description provided.