Skip to content

feat: add email notification & profile endpoint#268

Open
VPiliaiev wants to merge 1 commit intomate-academy:mainfrom
VPiliaiev:develop
Open

feat: add email notification & profile endpoint#268
VPiliaiev wants to merge 1 commit intomate-academy:mainfrom
VPiliaiev:develop

Conversation

@VPiliaiev
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.

Review Summary

Great work on this submission! I am happy to approve your solution as you've successfully implemented all the required features for email notifications and profile creation. The asynchronous email sending and Pydantic validation are handled very well.

As a point for improvement, consider making your exception handling more specific in src/routes/profiles.py. Catching a generic Exception for token decoding and file uploads can sometimes hide the true source of a problem. For example, a bug in the code might be incorrectly reported as an expired token. Using more specific exceptions, like BaseSecurityError for token issues, will make your code more robust and easier to debug.

Overall, this is a fantastic submission. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

try:
payload = jwt_manager.decode_access_token(token)
token_user_id = payload.get("user_id")
except Exception as e:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching a generic Exception here is a bit too broad. It could catch unexpected errors that aren't related to token validation and report them as an expired token. It's better practice to catch a more specific exception. For instance, in routes/accounts.py, BaseSecurityError is used for handling token decoding errors.

contents = await data.avatar.read()
avatar_key = f"avatars/{user_id}_{data.avatar.filename}"
await storage.upload_file(avatar_key, contents)
except Exception:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the token decoding, catching a generic Exception for the file upload can hide the true cause of a problem. The storage client might raise more specific exceptions for different issues (e.g., connection errors, permission problems). Consider catching a more specific exception related to storage operations to make debugging easier.

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.

2 participants