renamed noteCache into becca

This commit is contained in:
zadam
2021-04-16 23:00:08 +02:00
parent af5b1021c7
commit f7e86c5be0
36 changed files with 199 additions and 199 deletions

View File

@@ -1,6 +1,6 @@
"use strict";
const noteCache = require('../../services/note_cache/note_cache');
const becca = require('../../services/note_cache/note_cache');
const log = require('../../services/log');
function getNotesAndBranchesAndAttributes(noteIds) {
@@ -23,7 +23,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
}
for (const childNote of note.children) {
const childBranch = noteCache.getBranch(childNote.noteId, note.noteId);
const childBranch = becca.getBranch(childNote.noteId, note.noteId);
collectedBranchIds.add(childBranch.branchId);
}
@@ -38,7 +38,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
}
for (const noteId of noteIds) {
const note = noteCache.notes[noteId];
const note = becca.notes[noteId];
if (!note) {
continue;
@@ -50,7 +50,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
const notes = [];
for (const noteId of collectedNoteIds) {
const note = noteCache.notes[noteId];
const note = becca.notes[noteId];
notes.push({
noteId: note.noteId,
@@ -75,7 +75,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
}
for (const branchId of collectedBranchIds) {
const branch = noteCache.branches[branchId];
const branch = becca.branches[branchId];
if (!branch) {
log.error(`Could not find branch for branchId=${branchId}`);
@@ -95,7 +95,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
const attributes = [];
for (const attributeId of collectedAttributeIds) {
const attribute = noteCache.attributes[attributeId];
const attribute = becca.attributes[attributeId];
attributes.push({
attributeId: attribute.attributeId,
@@ -127,7 +127,7 @@ function getTree(req) {
for (const childNote of parentNote.children) {
collectedNoteIds.add(childNote.noteId);
const childBranch = noteCache.getBranch(childNote.noteId, parentNote.noteId);
const childBranch = becca.getBranch(childNote.noteId, parentNote.noteId);
if (childBranch.isExpanded) {
collect(childBranch.childNote);
@@ -135,11 +135,11 @@ function getTree(req) {
}
}
if (!(subTreeNoteId in noteCache.notes)) {
if (!(subTreeNoteId in becca.notes)) {
return [404, `Note ${subTreeNoteId} not found in the cache`];
}
collect(noteCache.notes[subTreeNoteId]);
collect(becca.notes[subTreeNoteId]);
return getNotesAndBranchesAndAttributes(collectedNoteIds);
}