Fix: Hinzufügen von Protokollausgaben zur Fehlerdiagnose in FalukantController und FalukantService

Änderung:
- In der Klasse FalukantController wurden Protokollausgaben hinzugefügt, um die Aufrufe der Methoden getDirectorProposals und getGifts zu verfolgen.
- In der Klasse FalukantService wurde eine Protokollausgabe hinzugefügt, um die Aufrufe der Methode getFalukantUserByHashedId zu dokumentieren und das Ergebnis zu protokollieren.

Diese Anpassung verbessert die Nachvollziehbarkeit der Methodenaufrufe und erleichtert die Fehlersuche im Backend.
This commit is contained in:
Torsten Schulz (local)
2025-09-08 09:19:18 +02:00
parent 5c7dc76288
commit e308d2025c
3 changed files with 15 additions and 6 deletions

View File

@@ -69,7 +69,10 @@ class FalukantController {
this.getStockOverview = this._wrapSimple(() => this.service.getStockOverview());
this.getAllProductions = this._wrapWithUser((userId) => this.service.getAllProductions(userId));
this.getDirectorProposals = this._wrapWithUser((userId, req) => this.service.getDirectorProposals(userId, req.body.branchId));
this.getDirectorProposals = this._wrapWithUser((userId, req) => {
console.log('🔍 getDirectorProposals called with userId:', userId, 'branchId:', req.body.branchId);
return this.service.getDirectorProposals(userId, req.body.branchId);
});
this.convertProposalToDirector = this._wrapWithUser((userId, req) => this.service.convertProposalToDirector(userId, req.body.proposalId));
this.getDirectorForBranch = this._wrapWithUser((userId, req) => this.service.getDirectorForBranch(userId, req.params.branchId));
this.getAllDirectors = this._wrapWithUser((userId) => this.service.getAllDirectors(userId));
@@ -89,7 +92,10 @@ class FalukantController {
return result;
});
this.acceptMarriageProposal = this._wrapWithUser((userId, req) => this.service.acceptMarriageProposal(userId, req.body.proposalId));
this.getGifts = this._wrapWithUser((userId) => this.service.getGifts(userId));
this.getGifts = this._wrapWithUser((userId) => {
console.log('🔍 getGifts called with userId:', userId);
return this.service.getGifts(userId);
});
this.getChildren = this._wrapWithUser((userId) => this.service.getChildren(userId));
this.sendGift = this._wrapWithUser((userId, req) => this.service.sendGift(userId, req.body.giftId));

View File

@@ -134,6 +134,7 @@ class FalukantService extends BaseService {
`;
async getFalukantUserByHashedId(hashedId) {
console.log('🔍 getFalukantUserByHashedId called with hashedId:', hashedId);
const user = await FalukantUser.findOne({
include: [
{ model: User, as: 'user', attributes: ['username', 'hashedId'], where: { hashedId } },
@@ -162,6 +163,7 @@ class FalukantService extends BaseService {
},
]
});
console.log('🔍 getFalukantUserByHashedId result:', user ? 'User found' : 'User not found');
if (!user) throw new Error('User not found');
return user;
}

View File

@@ -132,13 +132,14 @@ const store = createStore({
console.log('🔌 Initializing Daemon WebSocket connection to:', daemonUrl);
console.log('🔌 Protocol:', 'yourpart-protocol');
try {
// Versuche zuerst mit Protokoll, dann ohne
// Versuche zuerst ohne Protokoll, da der Server es möglicherweise nicht unterstützt
let daemonSocket;
try {
daemonSocket = new WebSocket(daemonUrl, 'yourpart-protocol');
} catch (protocolError) {
console.warn('⚠️ Protocol error, trying without protocol:', protocolError);
console.log('🔌 Trying WebSocket connection without protocol...');
daemonSocket = new WebSocket(daemonUrl);
} catch (error) {
console.error('❌ Failed to create WebSocket:', error);
throw error;
}
daemonSocket.onopen = () => {