diff --git a/backend/src/tools/schocken/routes.js b/backend/src/tools/schocken/routes.js index ecb00a9..37d65a3 100644 --- a/backend/src/tools/schocken/routes.js +++ b/backend/src/tools/schocken/routes.js @@ -586,4 +586,19 @@ function getGame(id, requesterId) { }; } +// ── Spiel abbrechen (Admin only, keine Punkte) ─────────────────────────────── +router.post('/:id/cancel', authenticate, (req, res) => { + if (req.user?.role !== 'admin') return res.status(403).json({ error: 'Nur Admin' }); + const game = db.prepare('SELECT * FROM schocken_games WHERE id=?').get(req.params.id); + if (!game) return res.status(404).json({ error: 'Nicht gefunden' }); + if (game.status === 'finished') return res.status(400).json({ error: 'Spiel bereits beendet' }); + db.prepare(`UPDATE schocken_games SET status='finished', phase_status='cancelled', + updated_at=datetime('now','localtime') WHERE id=?`).run(game.id); + const players = JSON.parse(game.players); + for (const p of players) { + sendPush(p.id, '🎲 Schocken', 'Das Spiel wurde vom Admin abgebrochen.'); + } + res.json({ ok: true }); +}); + module.exports = router; diff --git a/frontend/src/tools/schocken.jsx b/frontend/src/tools/schocken.jsx index 21000e4..840cda0 100644 --- a/frontend/src/tools/schocken.jsx +++ b/frontend/src/tools/schocken.jsx @@ -147,19 +147,63 @@ function DiceArea({ game, myId, onRoll, onReady, onEvaluate }) { ); } - // Auswertungsphase + // Auswertungsphase — alle Würfel sichtbar if (allDone) { const isFirstPlayer = activePlayers[0]?.id === myId || players[0]?.id === myId; return (