[Bug][Medium] username unvalidated and not uniqueness-checked on user update
#13
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium · Type: Bug / validation
Problem
PUT /admin/users/:idvalidatespasswordandrolebut notusername(server/src/router/v1/admin/admin.routes.js:154-161), yet the controller writesreq.body.username(admin.controller.js:485).createUser, which does check) — it hits the DB unique constraint and surfaces as an opaque500 Internal Server Error.Suggested fix
Add the same validator used on create and a uniqueness pre-check:
In
updateUser, ifusernameis changing, verify no other user already has it and return409instead of letting the DB throw.