This commit is contained in:
parent
8027e92685
commit
c81fd6db24
1 changed files with 10 additions and 0 deletions
10
server.js
10
server.js
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue