full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

🐛 Handle non-existing user IDs in `read_user_by_id`

Open saltie2193 opened this issue 1 year ago • 5 comments

Fix an issue where read_user_by_id would fail to return if the requested user ID did not exist.

  • Return 404 - Not Found when ID does not exist.
  • Request without sufficient permission will always result in 403 - Unauthorized.
  • Add tests to test requesting non-existing user IDs as superuser and normal user.

saltie2193 avatar Oct 12 '24 18:10 saltie2193

Hello. I'd like to know why this pull request has not been approved. It is valid.

berar avatar Nov 07 '24 21:11 berar

Yeah pretty minor upgrade but it makes sens to merge IMO.

jonbzt avatar Dec 28 '24 21:12 jonbzt

@YuriiMotov please have a look at the adjustments I made. I hope I could address all your concerns.

Note, I rebased the original commits onto the master branch so test_get_existing_user_current_user does not show as code contributed by me, since I did not change it.

saltie2193 avatar Sep 05 '25 18:09 saltie2193

From my side this is ready to merge.

@YuriiMotov, thank you for taking the time to review this pull request!

saltie2193 avatar Sep 09 '25 07:09 saltie2193

This pull request has a merge conflict that needs to be resolved.

github-actions[bot] avatar Sep 20 '25 16:09 github-actions[bot]