diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp index a007ac1..f906431 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/InventoryManagementService.cpp @@ -270,6 +270,7 @@ void InventoryManagementService::sendNotification(User* user, const std::string& { return; } + auto& trackedNotificationsMap = m_dataStore.getNotifications(); Notification* notification = Factory::getObject( user->getId(), title, @@ -279,7 +280,6 @@ void InventoryManagementService::sendNotification(User* user, const std::string& { throw std::runtime_error("Failed to create notification"); } - auto& trackedNotificationsMap = m_dataStore.getNotifications(); trackedNotificationsMap.insert(notification->getId(), util::createNewRecord(notification)); m_dataStore.saveNotifications(); EventManager::sendNotificationAvailableEvent(user->getId()); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp index 09bf1da..dad4421 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/PaymentManagementService.cpp @@ -98,6 +98,7 @@ void PaymentManagementService::sendNotification(User* user, const std::string& t { return; } + auto& trackedNotificationsMap = m_dataStore.getNotifications(); Notification* notification = Factory::getObject( user->getId(), title, @@ -107,7 +108,6 @@ void PaymentManagementService::sendNotification(User* user, const std::string& t { throw std::runtime_error("Failed to create notification"); } - auto& trackedNotificationsMap = m_dataStore.getNotifications(); trackedNotificationsMap.insert(notification->getId(), util::createNewRecord(notification)); m_dataStore.saveNotifications(); EventManager::sendNotificationAvailableEvent(user->getId()); diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp index cf438d0..e703453 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/services/ServiceManagementService.cpp @@ -188,6 +188,7 @@ void ServiceManagementService::sendNotification(User* user, const std::string& t { return; } + auto& trackedNotificationsMap = m_dataStore.getNotifications(); Notification* notification = Factory::getObject( user->getId(), title, @@ -197,7 +198,6 @@ void ServiceManagementService::sendNotification(User* user, const std::string& t { throw std::runtime_error("Failed to create notification"); } - auto& trackedNotificationsMap = m_dataStore.getNotifications(); trackedNotificationsMap.insert(notification->getId(), util::createNewRecord(notification)); m_dataStore.saveNotifications(); EventManager::sendNotificationAvailableEvent(user->getId());