diff --git a/server.js b/server.js index ea8e6e1..2905131 100644 --- a/server.js +++ b/server.js @@ -540,6 +540,16 @@ app.get('/api/client-users', auth, (req, res) => { res.json(result); }); +app.post('/api/admin/sync-client-users', auth, (req, res) => { + if (!req.user?.is_admin) return res.status(403).json({ error: 'forbidden' }); + refreshService.syncClientUsers() + .then(() => { + const count = db.prepare('SELECT COUNT(*) as c FROM client_users').get(); + res.json({ ok: true, count: count.c }); + }) + .catch((e) => res.status(500).json({ error: e.message })); +}); + app.get('/api/tasks', auth, (req, res) => { const cache = db.prepare('SELECT * FROM tasks_cache WHERE id=1').get(); const sync = refreshService.getStatusSnapshot();