feat: Schocken - Testmodus Spieler-Switcher für Admin

This commit is contained in:
2026-07-05 00:17:26 +02:00
parent 19619cb57c
commit 1806d0bdfe
2 changed files with 45 additions and 4 deletions

View File

@@ -102,7 +102,15 @@ function sendPush(userId, title, message) {
}).catch(() => {});
}
const uid = req => req.user.id;
const uid = req => {
// Testmodus: Admin kann als anderen User agieren
const testAs = req.headers['x-schocken-test-as'];
if (testAs && req.user?.role === 'admin') {
const testId = parseInt(testAs);
if (!isNaN(testId)) return testId;
}
return req.user.id;
};
// ── Alle Spiele des Users ─────────────────────────────────────────────────────
router.get('/', authenticate, (req, res) => {