Commented out admin check, unsure as to whether or not more than one admin can exist

This commit is contained in:
Alex Holliday
2024-07-23 14:30:27 -07:00
parent c77414f2d7
commit 608153b461
6 changed files with 23 additions and 23 deletions
+15 -14
View File
@@ -59,20 +59,21 @@ const registerController = async (req, res, next) => {
return;
}
// Check if an admin user exists, if so, error
try {
const admin = await req.db.checkAdmin(req, res);
console.log(admin);
if (admin === true) {
throw new Error(errorMessages.AUTH_ADMIN_EXISTS);
}
} catch (error) {
console.log("WEEEEEEE", error.message);
error.service = SERVICE_NAME;
error.status = 403;
next(error);
return;
}
// TODO Can there be more than one admin?
// // Check if an admin user exists, if so, error
// try {
// const admin = await req.db.checkAdmin(req, res);
// console.log(admin);
// if (admin === true) {
// throw new Error(errorMessages.AUTH_ADMIN_EXISTS);
// }
// } catch (error) {
// console.log("WEEEEEEE", error.message);
// error.service = SERVICE_NAME;
// error.status = 403;
// next(error);
// return;
// }
// Create a new user
try {