Pushover: Emergency-Priorität mit Retry, has_pushover Badge in Admin

This commit is contained in:
2026-05-29 09:00:10 +02:00
parent 8f7dbbf3c9
commit 9b54bb700b
5 changed files with 123 additions and 26 deletions

View File

@@ -31,7 +31,13 @@ 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, last_active_at FROM users ORDER BY role DESC, username").all();
const users = db.prepare(`
SELECT u.id, u.username, u.role, u.created_at, u.last_active_at,
CASE WHEN p.user_id IS NOT NULL THEN 1 ELSE 0 END as has_pushover
FROM users u
LEFT JOIN pushover_settings p ON p.user_id = u.id
ORDER BY u.role DESC, u.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;