return updated settings
This commit is contained in:
1 parent
7c275db662
commit
7d333c6d93
3 files changed
+22
-16
No files matched your search
@@ -11,8 +11,7 @@ class SettingsController {
|
||||
this.emailService = emailService;
|
||||
}
|
||||
|
||||
getAppSettings = async (req, res, next) => {
|
||||
const dbSettings = await this.settingsService.getDBSettings();
|
||||
buildAppSettings = (dbSettings) => {
|
||||
const sanitizedSettings = { ...dbSettings };
|
||||
delete sanitizedSettings.version;
|
||||
|
||||
@@ -30,6 +29,14 @@ class SettingsController {
|
||||
delete sanitizedSettings.systemEmailPassword;
|
||||
}
|
||||
returnSettings.settings = sanitizedSettings;
|
||||
return returnSettings;
|
||||
};
|
||||
|
||||
getAppSettings = async (req, res, next) => {
|
||||
const dbSettings = await this.settingsService.getDBSettings();
|
||||
|
||||
const returnSettings = this.buildAppSettings(dbSettings);
|
||||
console.log(returnSettings);
|
||||
return res.success({
|
||||
msg: this.stringService.getAppSettings,
|
||||
data: returnSettings,
|
||||
@@ -45,12 +52,11 @@ class SettingsController {
|
||||
}
|
||||
|
||||
try {
|
||||
await this.db.updateAppSettings(req.body);
|
||||
const updatedSettings = { ...(await this.settingsService.reloadSettings()) };
|
||||
delete updatedSettings.jwtSecret;
|
||||
const updatedSettings = await this.db.updateAppSettings(req.body);
|
||||
const returnSettings = this.buildAppSettings(updatedSettings);
|
||||
return res.success({
|
||||
msg: this.stringService.updateAppSettings,
|
||||
data: updatedSettings,
|
||||
data: returnSettings,
|
||||
});
|
||||
} catch (error) {
|
||||
next(handleError(error, SERVICE_NAME, "updateAppSettings"));
|
||||
|
||||
Reference in new issue
Block a user