Fix: detach removed users from service observers

- detach users from InventoryManagementService observers during removal
- detach users from PaymentManagementService observers during removal
- detach users from ServiceManagementService observers during removal

Fixes #1783
This commit is contained in:
2026-05-27 11:10:59 +05:30
parent 13b7d6d40a
commit a9c8ec93b7
@@ -297,6 +297,9 @@ Return type: void
*/
void UserManagementService::removeUser(const std::string& userID)
{
InventoryManagementService inventoryManagementService;
PaymentManagementService paymentManagementService;
ServiceManagementService serviceManagementService;
int index = m_dataStore.getUsers().find(userID);
if (index != -1)
{
@@ -304,6 +307,9 @@ void UserManagementService::removeUser(const std::string& userID)
if (user != nullptr)
{
user->setState(util::State::INACTIVE);
inventoryManagementService.detach(user);
paymentManagementService.detach(user);
serviceManagementService.detach(user);
}
}
}