use standard search to find notes with same attrs

This commit is contained in:
zadam
2020-06-18 22:28:18 +02:00
parent a87e59cecb
commit f700e6e12b
7 changed files with 93 additions and 58 deletions

View File

@@ -258,14 +258,6 @@ async function deleteRelation(req) {
}
}
async function getNotesWithAttribute(req) {
const {type, name, value} = req.body;
const notes = await attributeService.getNotesWithAttribute(type, name, value);
return notes.map(note => note.noteId);
}
module.exports = {
updateNoteAttributes,
updateNoteAttributes2,
@@ -275,6 +267,5 @@ module.exports = {
getValuesForAttribute,
getEffectiveNoteAttributes,
createRelation,
deleteRelation,
getNotesWithAttribute
deleteRelation
};

View File

@@ -7,12 +7,13 @@ const scriptService = require('../../services/script');
const searchService = require('../../services/search/search');
async function searchNotes(req) {
const notePaths = await searchService.searchNotes(req.params.searchString);
const {count, results} = await searchService.searchNotes(req.params.searchString);
try {
return {
success: true,
results: notePaths
count,
results
}
}
catch {