Skip to content

Commit

Permalink
user/checkusernameavailability now returns boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Sep 22, 2024
1 parent d91629a commit 6e73747
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions controllers/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,7 @@ class UserController {
}

User.findOne({name: {$eq: username}}).lean().then(userFound => {
if (userFound) {
return resolve(HTTPWTHandler.OK('Username is not available'))
} else {
return resolve(HTTPWTHandler.OK('Username is available'))
}
return resolve(HTTPWTHandler.OK(!userFound))
}).catch(err => {
console.error('An error occurred while finding one user with name:', username, '. The error was:', err)
return resolve(HTTPWTHandler.serverError('An error occurred while finding user with username. Please try again.'))
Expand Down

0 comments on commit 6e73747

Please sign in to comment.