mirror of
https://github.com/zadam/trilium.git
synced 2024-12-25 08:43:03 +08:00
sync fixes
This commit is contained in:
parent
0df7b0bfcf
commit
7af6b69331
2 changed files with 6 additions and 8 deletions
|
@ -46,19 +46,19 @@ router.get('/notes_history/:noteHistoryId', auth.checkApiAuth, async (req, res,
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put('/notes', auth.checkApiAuth, async (req, res, next) => {
|
router.put('/notes', auth.checkApiAuth, async (req, res, next) => {
|
||||||
await sync.updateNote(req.body.entity, req.body.links, req.body.source_id);
|
await sync.updateNote(req.body.entity, req.body.links, req.body.sourceId);
|
||||||
|
|
||||||
res.send({});
|
res.send({});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put('/notes_tree', auth.checkApiAuth, async (req, res, next) => {
|
router.put('/notes_tree', auth.checkApiAuth, async (req, res, next) => {
|
||||||
await sync.updateNoteTree(req.body.entity, req.body.source_id);
|
await sync.updateNoteTree(req.body.entity, req.body.sourceId);
|
||||||
|
|
||||||
res.send({});
|
res.send({});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.put('/notes_history', auth.checkApiAuth, async (req, res, next) => {
|
router.put('/notes_history', auth.checkApiAuth, async (req, res, next) => {
|
||||||
await sync.updateNoteHistory(req.body.entity, req.body.source_id);
|
await sync.updateNoteHistory(req.body.entity, req.body.sourceId);
|
||||||
|
|
||||||
res.send({});
|
res.send({});
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,13 +50,13 @@ async function pullSync(cookieJar, syncLog) {
|
||||||
// TODO: ideally this should be in transaction
|
// TODO: ideally this should be in transaction
|
||||||
|
|
||||||
if (sync.entity_name === 'notes') {
|
if (sync.entity_name === 'notes') {
|
||||||
await updateNote(resp.entity, resp.links, sync.source_id, syncLog)
|
await updateNote(resp.entity, resp.links, sync.source_id, syncLog);
|
||||||
}
|
}
|
||||||
else if (sync.entity_name === 'notes_tree') {
|
else if (sync.entity_name === 'notes_tree') {
|
||||||
await updateNoteTree(resp, sync.source_id, syncLog)
|
await updateNoteTree(resp, sync.source_id, syncLog);
|
||||||
}
|
}
|
||||||
else if (sync.entity_name === 'notes_history') {
|
else if (sync.entity_name === 'notes_history') {
|
||||||
await updateNoteHistory(resp, sync.source_id, syncLog)
|
await updateNoteHistory(resp, sync.source_id, syncLog);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logSync("Unrecognized entity type " + sync.entity_name, syncLog);
|
logSync("Unrecognized entity type " + sync.entity_name, syncLog);
|
||||||
|
@ -207,8 +207,6 @@ function logSync(message, syncLog) {
|
||||||
if (syncLog) {
|
if (syncLog) {
|
||||||
syncLog.push(message);
|
syncLog.push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getChanged(lastSyncId, sourceId) {
|
async function getChanged(lastSyncId, sourceId) {
|
||||||
|
|
Loading…
Reference in a new issue