note content refactoring, WIP

This commit is contained in:
zadam
2019-02-06 21:29:23 +01:00
parent 8884177d9f
commit c487a95bc7
17 changed files with 158 additions and 123 deletions

View File

@@ -42,6 +42,14 @@ async function getNote(noteId) {
return await getEntity("SELECT * FROM notes WHERE noteId = ?", [noteId]);
}
/** @returns {Promise<Note|null>} */
async function getNoteWithContent(noteId) {
const note = await getEntity("SELECT * FROM notes WHERE noteId = ?", [noteId]);
await note.getNoteContent();
return note;
}
/** @returns {Promise<NoteContent|null>} */
async function getNoteContent(noteContentId) {
return await getEntity("SELECT * FROM note_contents WHERE noteContentId = ?", [noteContentId]);
@@ -126,6 +134,7 @@ module.exports = {
getEntities,
getEntity,
getNote,
getNoteWithContent,
getNoteContent,
getBranch,
getAttribute,