note cache refactoring

This commit is contained in:
zadam
2020-05-13 14:42:16 +02:00
parent b07accfd9d
commit 7992f32d34
7 changed files with 210 additions and 164 deletions

View File

@@ -98,10 +98,11 @@ async function updateNoteAttributes(req) {
if (attribute.type !== attributeEntity.type
|| attribute.name !== attributeEntity.name
|| (attribute.type === 'relation' && attribute.value !== attributeEntity.value)) {
|| (attribute.type === 'relation' && attribute.value !== attributeEntity.value)
|| attribute.isInheritable !== attributeEntity.isInheritable) {
if (attribute.type !== 'relation' || !!attribute.value.trim()) {
const newAttribute = attributeEntity.createClone(attribute.type, attribute.name, attribute.value);
const newAttribute = attributeEntity.createClone(attribute.type, attribute.name, attribute.value, attribute.isInheritable);
await newAttribute.save();
}

View File

@@ -12,7 +12,7 @@ async function getSimilarNotes(req) {
return [404, `Note ${noteId} not found.`];
}
const results = await noteCacheService.findSimilarNotes(note.title);
const results = await noteCacheService.findSimilarNotes(noteId);
return results
.filter(note => note.noteId !== noteId);
@@ -20,4 +20,4 @@ async function getSimilarNotes(req) {
module.exports = {
getSimilarNotes
};
};