mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
use standard search to find notes with same attrs
This commit is contained in:
@@ -41,27 +41,6 @@ const BUILTIN_ATTRIBUTES = [
|
||||
{ type: 'relation', name: 'renderNote', isDangerous: true }
|
||||
];
|
||||
|
||||
async function getNotesWithAttribute(type, name, value) {
|
||||
let valueCondition = "";
|
||||
let params = [type, name];
|
||||
|
||||
if (value !== undefined) {
|
||||
valueCondition = " AND attributes.value = ?";
|
||||
params.push(value);
|
||||
}
|
||||
|
||||
return await repository.getEntities(`
|
||||
SELECT notes.*
|
||||
FROM notes
|
||||
JOIN attributes USING (noteId)
|
||||
WHERE notes.isDeleted = 0
|
||||
AND attributes.isDeleted = 0
|
||||
AND attributes.type = ?
|
||||
AND attributes.name = ?
|
||||
${valueCondition}
|
||||
ORDER BY position`, params);
|
||||
}
|
||||
|
||||
async function getNotesWithLabel(name, value) {
|
||||
let valueCondition = "";
|
||||
let params = [name];
|
||||
@@ -155,7 +134,6 @@ function getBuiltinAttributeNames() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getNotesWithAttribute,
|
||||
getNotesWithLabel,
|
||||
getNotesWithLabels,
|
||||
getNoteWithLabel,
|
||||
|
||||
Reference in New Issue
Block a user