split out note's content into separate entity, WIP

This commit is contained in:
zadam
2019-02-06 20:19:25 +01:00
parent 8b250ed523
commit 8884177d9f
18 changed files with 417 additions and 213 deletions

View File

@@ -37,27 +37,32 @@ async function getEntity(query, params = []) {
return entityConstructor.createEntityFromRow(row);
}
/** @returns {Note|null} */
/** @returns {Promise<Note|null>} */
async function getNote(noteId) {
return await getEntity("SELECT * FROM notes WHERE noteId = ?", [noteId]);
}
/** @returns {Branch|null} */
/** @returns {Promise<NoteContent|null>} */
async function getNoteContent(noteContentId) {
return await getEntity("SELECT * FROM note_contents WHERE noteContentId = ?", [noteContentId]);
}
/** @returns {Promise<Branch|null>} */
async function getBranch(branchId) {
return await getEntity("SELECT * FROM branches WHERE branchId = ?", [branchId]);
}
/** @returns {Attribute|null} */
/** @returns {Promise<Attribute|null>} */
async function getAttribute(attributeId) {
return await getEntity("SELECT * FROM attributes WHERE attributeId = ?", [attributeId]);
}
/** @returns {Option|null} */
/** @returns {Promise<Option|null>} */
async function getOption(name) {
return await getEntity("SELECT * FROM options WHERE name = ?", [name]);
}
/** @returns {Link|null} */
/** @returns {Promise<Link|null>} */
async function getLink(linkId) {
return await getEntity("SELECT * FROM links WHERE linkId = ?", [linkId]);
}
@@ -121,6 +126,7 @@ module.exports = {
getEntities,
getEntity,
getNote,
getNoteContent,
getBranch,
getAttribute,
getOption,