Merge pull request #243 from bluewave-labs/feat/check-admin

Feat/check admin, resolves #241
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-02 14:22:05 -07:00
commit 75d16b749d
4 files changed
+40

No files matched your search

+13
View File
@@ -171,6 +171,18 @@ const resetPassword = async (req, res) => {
}
};
const checkAdmin = async (req, res) => {
try {
const admin = await UserModel.findOne({ role: "admin" });
if (admin !== null) {
return true;
}
return false;
} catch (error) {
throw error;
}
};
//****************************************
// Monitors
//****************************************
@@ -510,6 +522,7 @@ module.exports = {
requestRecoveryToken,
validateRecoveryToken,
resetPassword,
checkAdmin,
getAllMonitors,
getMonitorById,
getMonitorsByUserId,