-
Notifications
You must be signed in to change notification settings - Fork 427
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
fix(user): correctly get user by token #2654
Conversation
WalkthroughThe changes to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UserService
participant Database
User->>UserService: Request user by token
UserService->>Database: Query user by token
Database-->>UserService: Return user data
UserService->>User: Return user or error
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/shared/lib/services/user.service.ts (1 hunks)
Additional comments not posted (1)
packages/shared/lib/services/user.service.ts (1)
24-36
: Refined logic and improved error handling ingetUserByToken
.The changes made to the
getUserByToken
method enhance its robustness and clarity:
- The use of
DBUser
for the database query ensures that the returned data structure is well-defined.- The conditional check for token expiration is crucial for avoiding errors when the expiration date is not set.
- Explicit error handling when a user is not found is a significant improvement.
The changes are approved as they align with the PR objectives to fix the user retrieval process based on a token.
Consider adding unit tests to cover these new conditions and ensure that the method behaves as expected under various scenarios.
Describe your changes
The
||
was incorrectly returning Ok all the time + type issueSummary by CodeRabbit
Bug Fixes
New Features