add update settings method, remove all env var references possible
This commit is contained in:
1 parent
992bf099fa
commit
11b97ab3b4
17 files changed
+149
-36
No files matched your search
@@ -137,7 +137,10 @@ const {
|
||||
//****************************************
|
||||
// AppSettings
|
||||
//****************************************
|
||||
const { getAppSettings } = require("./modules/settingsModule");
|
||||
const {
|
||||
getAppSettings,
|
||||
updateAppSettings,
|
||||
} = require("./modules/settingsModule");
|
||||
|
||||
module.exports = {
|
||||
connect,
|
||||
@@ -187,4 +190,5 @@ module.exports = {
|
||||
getNotificationsByMonitorId,
|
||||
deleteNotificationsByMonitorId,
|
||||
getAppSettings,
|
||||
updateAppSettings,
|
||||
};
|
||||
@@ -12,6 +12,22 @@ const getAppSettings = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const updateAppSettings = async (newSettings) => {
|
||||
try {
|
||||
const settings = await AppSettings.findOneAndUpdate(
|
||||
{},
|
||||
{ $set: newSettings },
|
||||
{ new: true }
|
||||
);
|
||||
return settings;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "updateAppSettings";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getAppSettings,
|
||||
updateAppSettings,
|
||||
};
|
||||
Reference in new issue
Block a user