Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
(REQUIRED)
We have two sets of admin user routes which do the same thing. I removed some so that we only have one route per function. This is a breaking change since I have removed routes, however the remaining routes have the same function signature, so if anyone is relying on these endpoints it's an easy migration:
GET /api/users
->GET /api/admin/users
POST /api/users
->POST /api/admin/users
GET /api/users/{item_id}
->GET /api/admin/users/{item_id}
DELETE /api/users/{item_id}
->DELETE /api/admin/users/{item_id}
Note:
PUT /api/users/{item_id}
still remains because this is the endpoint for all users to update their own info. Maybe down the line we change this to/self
(similar to theGET
API).I also added some helpful error messages for if an admin tries to create a new user with an existing username and/or email (see: #2866).
Which issue(s) this PR fixes:
(REQUIRED)
Fixes #2866
Testing
(fill-in or delete this section)
Tested the frontend to make sure admin management still works, as well as all basic user management (e.g. updating your own profile).