cleanup of note (& revisions) content is now postponed and done 48 hours after deleting it. This makes it possible to correct user mistake without having to use a real backup

This commit is contained in:
azivner
2018-11-01 10:23:21 +01:00
parent 370efdc034
commit 80178b52c0
2 changed files with 33 additions and 5 deletions

View File

@@ -104,6 +104,13 @@ class Note extends Entity {
return await repository.getEntities(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ?`, [this.noteId]);
}
/**
* @returns {Promise<Attribute[]>} relations targetting this specific note
*/
async getTargetRelations() {
return await repository.getEntities("SELECT * FROM attributes WHERE type = 'relation' AND isDeleted = 0 AND value = ?", [this.noteId]);
}
/**
* @param {string} [name] - attribute name to filter
* @returns {Promise<Attribute[]>} all note's attributes, including inherited ones