-
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 #35
base: main
Are you sure you want to change the base?
Solution #35
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 meets the core functionality needed for user account and movie management. While there are a few areas for improvement, such as enhancing error messages for clarity and ensuring password security, these are minor and don't impact the overall functionality. 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! ✨
detail=f"A user with this email {user_data.email} already exists." | ||
) | ||
|
||
group = db.query(UserGroupModel).filter(UserGroupModel.name == UserGroupEnum.USER).first() |
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 UserGroupEnum.USER
is correctly defined and accessible. If the enum value is not found, this line will raise an error. Consider adding error handling or validation to ensure the group exists.
db.rollback() | ||
raise HTTPException( | ||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | ||
detail="An error occurred during user activation." |
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 detail message here is incorrect. It should mention an error during password reset request instead of user activation. Consider updating the error message for clarity.
if is_bad_token: | ||
db.commit() | ||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid email or token.") | ||
user.password = user_data.password |
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 user_data.password
is hashed before being stored in the database. Storing plain text passwords is a security risk. Consider using the hash_password
function to hash the password before assignment.
@@ -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.
The error message here should be more specific to the context of movie creation. Consider updating the detail message to reflect that the error occurred during movie creation.
@@ -394,6 +394,6 @@ def update_movie( | |||
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.
The error message here should be more specific to the context of movie updating. Consider updating the detail message to reflect that the error occurred during movie updating.
No description provided.