we now remember past source ids so app restart won't change anything in sync operation

This commit is contained in:
azivner
2017-11-16 21:50:00 -05:00
parent 9e7fcdfe15
commit b2d1ca1c28
15 changed files with 144 additions and 104 deletions

View File

@@ -5,6 +5,7 @@ const router = express.Router();
const sql = require('../../services/sql');
const auth = require('../../services/auth');
const utils = require('../../services/utils');
const sync_table = require('../../services/sync_table');
router.get('', auth.checkApiAuth, async (req, res, next) => {
res.send(await getRecentNotes());
@@ -17,7 +18,7 @@ router.put('/:noteId', auth.checkApiAuth, async (req, res, next) => {
is_deleted: 0
});
await sql.addRecentNoteSync(req.params.noteId);
await sync_table.addRecentNoteSync(req.params.noteId);
res.send(await getRecentNotes());
});
@@ -25,7 +26,7 @@ router.put('/:noteId', auth.checkApiAuth, async (req, res, next) => {
router.delete('/:noteId', auth.checkApiAuth, async (req, res, next) => {
await sql.execute('UPDATE recent_notes SET is_deleted = 1 WHERE note_id = ?', [req.params.noteId]);
await sql.addRecentNoteSync(req.params.noteId);
await sync_table.addRecentNoteSync(req.params.noteId);
res.send(await getRecentNotes());
});