add update settings method, remove all env var references possible

This commit is contained in:
Alex Holliday committed 2024-09-26 14:37:11 +08:00
1 parent 992bf099fa
commit 11b97ab3b4
17 files changed
+149 -36

No files matched your search

+16
View File
@@ -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,
};