implementation of forcing full (re)sync

This commit is contained in:
azivner
2017-12-13 23:03:48 -05:00
parent e6686c4b32
commit b0cbe91784
8 changed files with 56 additions and 38 deletions

View File

@@ -20,6 +20,18 @@ router.post('/now', auth.checkApiAuth, async (req, res, next) => {
res.send(await sync.sync());
});
router.post('/force-full-sync', auth.checkApiAuth, async (req, res, next) => {
await sql.doInTransaction(async () => {
await options.setOption('last_synced_pull', 0);
await options.setOption('last_synced_push', 0);
});
// not awaiting for the job to finish (will probably take a long time)
sync.sync();
res.send({});
});
router.get('/changed', auth.checkApiAuth, async (req, res, next) => {
const lastSyncId = parseInt(req.query.lastSyncId);