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

fix(#173): throw 409 on user already exists #185

Merged
merged 1 commit into from
Oct 3, 2024
Merged

fix(#173): throw 409 on user already exists #185

merged 1 commit into from
Oct 3, 2024

Conversation

h1alexbel
Copy link
Owner

@h1alexbel h1alexbel commented Oct 3, 2024

closes #173


PR-Codex overview

This PR focuses on modifying the register_user function to return a tuple containing a StatusCode and an error message when a user registration fails, specifically returning a StatusCode::CONFLICT for existing users. Additionally, it introduces a new test case for this behavior.

Detailed summary

  • Changed the return type of register_user from Result<StatusCode, String> to Result<StatusCode, (StatusCode, String)>.
  • Updated the error handling to return StatusCode::CONFLICT when user registration fails due to an existing user.
  • Added a new test case returns_409_when_user_exists to verify that a conflict status is returned when trying to register an existing user.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@h1alexbel
Copy link
Owner Author

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Oct 3, 2024

@rultor merge

@h1alexbel OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 3aeb8b9 into master Oct 3, 2024
12 checks passed
@rultor
Copy link
Collaborator

rultor commented Oct 3, 2024

@rultor merge

@h1alexbel Done! FYI, the full log is here (took me 15min)

@h1alexbel h1alexbel deleted the 173 branch October 3, 2024 15:45
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.19%. Comparing base (22448a3) to head (3aeb8b9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
+ Coverage   82.13%   82.19%   +0.06%     
==========================================
  Files          16       16              
  Lines         291      292       +1     
==========================================
+ Hits          239      240       +1     
  Misses         52       52              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@0crat
Copy link

0crat commented Oct 3, 2024

@h1alexbel Great work on your contribution! 🌟 You've earned +4 points, bringing your total to +67. While there's room for improvement in code reviews and comments, we appreciate your effort. Keep the contributions coming – your progress is valuable to the team!

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.

returns 200 OK on user already exists
3 participants