Schnellzugriff: Reihenfolge per Drag & Drop änderbar

This commit is contained in:
2026-05-29 10:32:37 +02:00
parent 3d5925b603
commit 2e033d8ad4
2 changed files with 69 additions and 2 deletions

View File

@@ -30,6 +30,14 @@ router.delete('/links/:id', authenticate, (req, res) => {
res.json({ success: true });
});
router.put('/links-order', authenticate, (req, res) => {
const { ids } = req.body;
if (!Array.isArray(ids)) return res.status(400).json({ error: 'ids erforderlich' });
const update = db.prepare('UPDATE quick_links SET sort_order=? WHERE id=? AND user_id=?');
db.transaction(() => { ids.forEach((id, i) => update.run(i, id, uid(req))); })();
res.json({ ok: true });
});
// ── Todos ─────────────────────────────────────────────────────────────────────
router.get('/todos', authenticate, (req, res) => {
res.json(db.prepare('SELECT * FROM todos WHERE user_id=? ORDER BY done,sort_order,id').all(uid(req)));