фикс статистики 6
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dv 2026-04-15 11:20:01 +03:00
parent 8027e92685
commit c81fd6db24

View file

@ -540,6 +540,16 @@ app.get('/api/client-users', auth, (req, res) => {
res.json(result); 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) => { app.get('/api/tasks', auth, (req, res) => {
const cache = db.prepare('SELECT * FROM tasks_cache WHERE id=1').get(); const cache = db.prepare('SELECT * FROM tasks_cache WHERE id=1').get();
const sync = refreshService.getStatusSnapshot(); const sync = refreshService.getStatusSnapshot();