Verbesserung: Erweiterung der Protokollausgaben im FalukantService zur Nachverfolgbarkeit von Verkaufsereignissen

Änderungen:
- Protokollausgaben wurden hinzugefügt, um die Ereignisse beim Verkauf von Produkten und beim Verkauf aller Produkte zu dokumentieren.
- Diese Anpassungen erhöhen die Nachvollziehbarkeit der Benutzerinteraktionen und verbessern die Fehlerdiagnose im Service.
This commit is contained in:
Torsten Schulz (local)
2025-09-11 16:26:43 +02:00
parent eb91a7d079
commit 22ed7cb786

View File

@@ -589,6 +589,7 @@ class FalukantService extends BaseService {
} }
} }
await this.addSellItem(branchId, user.id, productId, quantity); await this.addSellItem(branchId, user.id, productId, quantity);
console.log('[FalukantService.sellProduct] emitting events for user', user.user.hashedId, 'branch', branch?.id);
notifyUser(user.user.hashedId, 'falukantUpdateStatus', {}); notifyUser(user.user.hashedId, 'falukantUpdateStatus', {});
notifyUser(user.user.hashedId, 'falukantBranchUpdate', { branchId: branch.id }); notifyUser(user.user.hashedId, 'falukantBranchUpdate', { branchId: branch.id });
return { success: true }; return { success: true };
@@ -654,6 +655,7 @@ class FalukantService extends BaseService {
for (const item of inventory) { for (const item of inventory) {
await Inventory.destroy({ where: { id: item.id } }); await Inventory.destroy({ where: { id: item.id } });
} }
console.log('[FalukantService.sellAllProducts] emitting events for user', falukantUser.user.hashedId, 'branch', branchId, 'revenue', total, 'items', inventory.length);
notifyUser(falukantUser.user.hashedId, 'falukantUpdateStatus', {}); notifyUser(falukantUser.user.hashedId, 'falukantUpdateStatus', {});
notifyUser(falukantUser.user.hashedId, 'falukantBranchUpdate', { branchId }); notifyUser(falukantUser.user.hashedId, 'falukantBranchUpdate', { branchId });
return { success: true, revenue: total }; return { success: true, revenue: total };