improvements to saved search

This commit is contained in:
zadam
2020-11-30 23:20:12 +01:00
parent 2a6978c349
commit a68c61b2f0
7 changed files with 37 additions and 21 deletions

View File

@@ -0,0 +1,23 @@
const repository = require('../../src/services/repository');
module.exports = () => {
for (const note of repository.getEntities("SELECT * FROM notes WHERE type = 'search' AND isProtected = 0 AND isDeleted = 0")) {
try {
let origContent = note.getJsonContent();
if (!origContent) {
continue;
}
note.addLabel('searchString', origContent.searchString);
note.setContent('');
note.mime = 'text/plain';
note.save();
}
catch (e) {
console.log(`Changing note content for note ${note.noteId} failed with: ${e.message} ${e.stack}`);
}
}
};