feat: Hex Wars - Zoom, Zug-Bestätigung, Design-Fix, Admin-Löschen

This commit is contained in:
2026-06-26 11:30:16 +02:00
parent c90490b64b
commit ada2625813
2 changed files with 254 additions and 153 deletions

View File

@@ -251,3 +251,13 @@ router.post('/:id/resign', authenticate, (req, res) => {
});
module.exports = router;
// ── Spiel löschen (nur Admin, nur beendete/aufgegebene) ───────────────────────
router.delete('/:id', authenticate, (req, res) => {
if (req.user?.role !== 'admin') return res.status(403).json({ error: 'Kein Zugriff' });
const game = db.prepare('SELECT * FROM geo_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: 'Nur beendete Spiele können gelöscht werden' });
db.prepare('DELETE FROM geo_games WHERE id=?').run(req.params.id);
res.json({ ok: true });
});