Basic user notifcation update
MODIFY
src/server/rest/service/UserService.ts
src/server/rest/service/UserService.ts
@@ -483,16 +483,10 @@ export default class UserService {
}
// Save Admin Data
if (filteredRequest.plateID || Utils.objectHasProperty(filteredRequest, 'notificationsActive')) {
- const adminData: { plateID?: string; notificationsActive?: boolean; notifications?: UserNotifications } = {};
+ const adminData: { plateID?: string; } = {};
if (filteredRequest.plateID) {
adminData.plateID = filteredRequest.plateID;
}
- if (Utils.objectHasProperty(filteredRequest, 'notificationsActive')) {
- adminData.notificationsActive = filteredRequest.notificationsActive;
- if (filteredRequest.notifications) {
- adminData.notifications = filteredRequest.notifications;
- }
- }
await UserStorage.saveUserAdminData(req.user.tenantID, user.id, adminData);
}
}

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
@@ -253,6 +253,7 @@ export default class UserStorage {
locale: userToSave.locale,
iNumber: userToSave.iNumber,
costCenter: userToSave.costCenter,
+ notificationsActive: userToSave.notificationsActive,
notifications: {
sendSessionStarted: userToSave.notifications ? Utils.convertToBoolean(userToSave.notifications.sendSessionStarted) : false,
sendOptimalChargeReached: userToSave.notifications ? Utils.convertToBoolean(userToSave.notifications.sendOptimalChargeReached) : false,

Basic user notifcation update