History: wiederhergestellte Version anzeigen, Lösch-Bestätigung, Admin-Stats Codes

This commit is contained in:
2026-05-29 14:45:30 +02:00
parent 05450e2b7e
commit eb95535afa
3 changed files with 16 additions and 7 deletions

View File

@@ -41,12 +41,13 @@ router.get('/users', authenticate, requireAdmin, (req, res) => {
const stats = users.map(u => {
const archiv = db.prepare('SELECT COUNT(*) c FROM calculations WHERE user_id=?').get(u.id).c;
const bestellung = db.prepare('SELECT COUNT(*) c FROM orders WHERE user_id=?').get(u.id).c;
const snippets_c = db.prepare('SELECT COUNT(*) c FROM snippets WHERE user_id=?').get(u.id).c;
const todos = db.prepare('SELECT COUNT(*) c FROM todos WHERE user_id=?').get(u.id).c;
const links = db.prepare('SELECT COUNT(*) c FROM quick_links WHERE user_id=?').get(u.id).c;
const files = db.prepare('SELECT COUNT(*) c FROM files WHERE user_id=?').get(u.id).c;
const noteLen = (db.prepare('SELECT content FROM notes WHERE user_id=?').get(u.id)?.content || '').length;
const icals = db.prepare('SELECT COUNT(*) c FROM calendar_feeds WHERE user_id=?').get(u.id).c;
return { ...u, archiv, bestellung, todos, links, files, icals, noteLen };
return { ...u, archiv, bestellung, snippets_c, todos, links, files, icals, noteLen };
});
res.json(stats);
});