From e308d2025cdf8ad78309285955cb9b73463cf697 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 8 Sep 2025 09:19:18 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Hinzuf=C3=BCgen=20von=20Protokollausgabe?= =?UTF-8?q?n=20zur=20Fehlerdiagnose=20in=20FalukantController=20und=20Falu?= =?UTF-8?q?kantService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ä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. --- backend/controllers/falukantController.js | 10 ++++++++-- backend/services/falukantService.js | 2 ++ frontend/src/store/index.js | 9 +++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/backend/controllers/falukantController.js b/backend/controllers/falukantController.js index ea722c2..ca0bfc6 100644 --- a/backend/controllers/falukantController.js +++ b/backend/controllers/falukantController.js @@ -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)); diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index 4851429..bd15530 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -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; } diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index c51e013..2525b85 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -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 = () => {