Admin: Letzte Aktivität pro User (nur echte Aktionen, kein Polling)

This commit is contained in:
2026-05-28 19:56:36 +02:00
parent d475c8f64f
commit 8f7dbbf3c9
4 changed files with 36 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ router.post('/restore', authenticate, requireAdmin, upload.single('database'), (
// GET /api/admin/users alle Benutzer mit Statistiken
router.get('/users', authenticate, requireAdmin, (req, res) => {
const users = db.prepare("SELECT id, username, role, created_at FROM users ORDER BY role DESC, username").all();
const users = db.prepare("SELECT id, username, role, created_at, last_active_at FROM users ORDER BY role DESC, username").all();
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;