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

Solution #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Solution #43

wants to merge 1 commit into from

Conversation

comnotaDidi
Copy link

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 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:

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:

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:

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:

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.")

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.")

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.

Comment on lines +58 to +60
email: EmailStr
token: str
password: str

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.

Comment on lines +61 to +62
class MessageResponseSchema(BaseModel):
message: str

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.

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.

3 participants