Board: Eingabe-Fix (ItemRow außerhalb), Promote-Button Wunsch→Roadmap

This commit is contained in:
2026-05-28 18:37:04 +02:00
parent afae09dd6e
commit f03d6a173a
3 changed files with 98 additions and 57 deletions

View File

@@ -189,4 +189,18 @@ router.delete('/board/:id', authenticate, (req, res) => {
res.json({ ok: true });
});
// Wunsch zur Roadmap befördern (Admin only)
router.post('/board/:id/promote', authenticate, (req, res) => {
if (req.user.role !== 'admin') return res.status(403).json({ error: 'Kein Zugriff' });
const item = db.prepare('SELECT * FROM board_items WHERE id=?').get(req.params.id);
if (!item) return res.status(404).json({ error: 'Nicht gefunden' });
if (item.type !== 'wish') return res.status(400).json({ error: 'Nur Wünsche können befördert werden' });
db.prepare('UPDATE board_items SET type=?, promoted_from_wish=1 WHERE id=?').run('roadmap', item.id);
const updated = db.prepare(`
SELECT b.*, u.username as author FROM board_items b
JOIN users u ON u.id=b.user_id WHERE b.id=?
`).get(item.id);
res.json(updated);
});
module.exports = router;