support for cssClass label on note

This commit is contained in:
azivner
2018-08-13 10:59:31 +02:00
parent 12d82e3b33
commit cd9eef32b0
6 changed files with 73 additions and 3 deletions

View File

@@ -26,10 +26,19 @@ async function cloneNoteToParent(noteId, parentNoteId, prefix) {
return { success: true };
}
// this is identical to cloneNoteToParent except for the intention - if cloned note is already in parent,
// then this is successful result
async function ensureNoteIsPresentInParent(noteId, parentNoteId, prefix) {
await cloneNoteToParent(noteId, parentNoteId, prefix);
const validationResult = await treeService.validateParentChild(parentNoteId, noteId);
if (!validationResult.success) {
return validationResult;
}
await new Branch({
noteId: noteId,
parentNoteId: parentNoteId,
prefix: prefix,
isExpanded: 0
}).save();
}
async function ensureNoteIsAbsentFromParent(noteId, parentNoteId) {

View File

@@ -10,6 +10,10 @@ async function setEntityConstructor(constructor) {
}
async function getEntityFromName(entityName, entityId) {
if (!entityName || !entityId) {
return null;
}
const constructor = entityConstructor.getEntityFromTableName(entityName);
return await getEntity(`SELECT * FROM ${constructor.tableName} WHERE ${constructor.primaryKeyName} = ?`, [entityId]);