-
Notifications
You must be signed in to change notification settings - Fork 48
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 #43
base: main
Are you sure you want to change the base?
Solution #43
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 user login endpoint! 🎉 Your code meets the task requirements and constraints effectively, handling user authentication, account activation checks, token generation, and error handling as specified. While there are some areas for improvement, such as logging specific error details for better debugging and refining schema definitions for clarity and reusability, these are minor issues that do not impact the core functionality of your solution. Keep up the good work, and consider the feedback for future enhancements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
db.refresh(user) | ||
return user | ||
|
||
except SQLAlchemyError: |
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.
Catching a general SQLAlchemyError
without logging the specific error details can make debugging difficult. Consider logging the exception details to help with troubleshooting.
user.password = data.password | ||
db.delete(expected_token) | ||
db.commit() | ||
except SQLAlchemyError: |
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 previous comment, catching a general SQLAlchemyError
without logging the specific error details can make debugging difficult. Consider logging the exception details to help with troubleshooting.
"refresh_token": refresh_token.token, | ||
"token_type": "bearer" | ||
} | ||
except SQLAlchemyError: |
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.
Again, catching a general SQLAlchemyError
without logging the specific error details can make debugging difficult. Consider logging the exception details to help with troubleshooting.
try: | ||
token_data = jwt_manager.decode_refresh_token(data.refresh_token) | ||
user_id = token_data["user_id"] | ||
except BaseSecurityError: |
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.
Catching BaseSecurityError
without logging the specific error details can make debugging difficult. Consider logging the exception details to help with troubleshooting.
@@ -208,7 +208,7 @@ def create_movie( | |||
return MovieDetailSchema.model_validate(movie) | |||
except IntegrityError: | |||
db.rollback() | |||
raise HTTPException(status_code=400, detail=f"Invalid input data.") | |||
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.
Catching a general IntegrityError
without logging the specific error details can make debugging difficult. Consider logging the exception details to help with troubleshooting.
@@ -394,6 +394,6 @@ | |||
db.refresh(movie) | |||
except IntegrityError: | |||
db.rollback() | |||
raise HTTPException(status_code=400, detail=f"Invalid input data.") | |||
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.
Similar to the previous comment on exception handling, catching a general IntegrityError
without logging the specific error details can make debugging difficult. Consider logging the exception details to help with troubleshooting.
email: EmailStr | ||
token: str | ||
password: str |
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 PasswordResetCompleteRequestSchema
inherits from BaseAuthUserSchema
, which already includes the email
and password
fields. Declaring them again in this schema is redundant and could lead to confusion. Consider removing the redundant fields.
class MessageResponseSchema(BaseModel): | ||
message: str |
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 MessageResponseSchema
is defined inside PasswordResetCompleteRequestSchema
, which is unusual. Consider defining MessageResponseSchema
as a separate class at the top level for better clarity and reusability.
No description provided.