-
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 #27
base: main
Are you sure you want to change the base?
solution #27
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! 🎉 While there are a few minor issues, such as redundant validation checks and an incorrect import statement, these do not significantly impact the functionality. Keep up the good work and consider addressing these minor points for cleaner code in the future! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -1,10 +1,77 @@ | |||
from math import ceil |
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 from math import ceil
is incorrect. It should be from math import ceil
without the division operator /
. This will cause a syntax error.
if page < 1: | ||
raise HTTPException( | ||
status_code=422, | ||
detail=[ | ||
{ | ||
"loc": ["query", "page"], | ||
"msg": "ensure this value is greater than or equal to 1", | ||
"type": "value_error.number.not_ge" | ||
} | ||
] | ||
) |
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 validation for page
being less than 1 is redundant because the Query
parameter already enforces ge=1
. This check can be removed to simplify the code.
if per_page < 1 or per_page > 20: | ||
raise HTTPException( | ||
status_code=422, | ||
detail=[ | ||
{ | ||
"loc": ["query", "per_page"], | ||
"msg": "ensure this value is between 1 and 20", | ||
"type": "value_error.number.not_in_range" | ||
} | ||
] | ||
) |
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 validation for per_page
being less than 1 or greater than 20 is redundant because the Query
parameter already enforces ge=1
and le=20
. This check can be removed to simplify the code.
|
||
class Config: | ||
orm_mode = True | ||
from_attributes = True |
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 from_attributes = True
configuration option is not a valid Pydantic configuration and should be removed. Pydantic models do not support this option.
No description provided.