This commit is contained in:
zadam
2020-01-25 13:46:55 +01:00
parent 7cad386a56
commit 516e6c35da
5 changed files with 13 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ const sql = require('../../services/sql');
const optionService = require('../../services/options');
const treeService = require('../../services/tree');
async function getNotesAndBranches(noteIds) {
async function getNotesAndBranchesAndAttributes(noteIds) {
noteIds = Array.from(new Set(noteIds));
const notes = await treeService.getNotes(noteIds);
@@ -45,20 +45,10 @@ async function getNotesAndBranches(noteIds) {
FROM attributes
WHERE isDeleted = 0 AND noteId IN (???)`, noteIds);
for (const {noteId, type, name, value, isInheritable} of attributes) {
const note = noteMap[noteId];
note.attributes.push({
type,
name,
value,
isInheritable
});
}
return {
branches,
notes
notes,
attributes
};
}
@@ -80,11 +70,11 @@ async function getTree() {
noteIds.push('root');
return await getNotesAndBranches(noteIds);
return await getNotesAndBranchesAndAttributes(noteIds);
}
async function load(req) {
return await getNotesAndBranches(req.body.noteIds);
return await getNotesAndBranchesAndAttributes(req.body.noteIds);
}
module.exports = {