mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
restore revision with attachments
This commit is contained in:
@@ -5,6 +5,8 @@ const utils = require('../../services/utils');
|
||||
const dateUtils = require('../../services/date_utils');
|
||||
const becca = require('../becca');
|
||||
const AbstractBeccaEntity = require("./abstract_becca_entity");
|
||||
const sql = require("../../services/sql");
|
||||
const BAttachment = require("./battachment");
|
||||
|
||||
/**
|
||||
* NoteRevision represents snapshot of note's title and content at some point in the past.
|
||||
@@ -92,6 +94,16 @@ class BNoteRevision extends AbstractBeccaEntity {
|
||||
this._setContent(content, opts);
|
||||
}
|
||||
|
||||
/** @returns {BAttachment[]} */
|
||||
getAttachments() {
|
||||
return sql.getRows(`
|
||||
SELECT attachments.*
|
||||
FROM attachments
|
||||
WHERE parentId = ?
|
||||
AND isDeleted = 0`, [this.noteRevisionId])
|
||||
.map(row => new BAttachment(row));
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
super.beforeSaving();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user