notes_tree now has note_tree_id so we stricly distinguish between working on notes or note trees

This commit is contained in:
azivner
2017-11-18 17:05:50 -05:00
parent dec9cad106
commit 5fb94fcbbd
17 changed files with 203 additions and 129 deletions

View File

@@ -8,6 +8,7 @@ const sync_table = require('./sync_table');
async function createNewNote(parentNoteId, note, browserId) {
const noteId = utils.newNoteId();
const noteTreeId = utils.newNoteId();
let newNotePos = 0;
@@ -50,6 +51,7 @@ async function createNewNote(parentNoteId, note, browserId) {
});
await sql.insert("notes_tree", {
'note_tree_id': noteTreeId,
'note_id': noteId,
'note_pid': parentNoteId,
'note_pos': newNotePos,
@@ -58,7 +60,11 @@ async function createNewNote(parentNoteId, note, browserId) {
'is_deleted': 0
});
});
return noteId;
return {
noteId,
noteTreeId
};
}
async function encryptNote(note, ctx) {