feat: Hex Wars - Zoom, Zug-Bestätigung, Design-Fix, Admin-Löschen
This commit is contained in:
@@ -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 });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user