diff --git a/backend/dao/user.js b/backend/dao/user.js index 7e38de7f4..2e88a9474 100644 --- a/backend/dao/user.js +++ b/backend/dao/user.js @@ -20,6 +20,17 @@ class UsersDAO { .updateOne({ uid }, { $set: { name } }); } + static async isNameAvailable(name) { + const nameDoc = await mongoDB() + .collection("users") + .findOne({ name }); + if (nameDoc){ + return false; + } else { + return true; + } + } + static async updateEmail(uid, email) { const user = await mongoDB().collection("users").findOne({ uid }); if (!user) throw new MonkeyError(404, "User not found");