mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
converted note revision protection to repository/entities
This commit is contained in:
@@ -1,13 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
const Entity = require('./entity');
|
||||
const protected_session = require('../services/protected_session');
|
||||
const repository = require('../services/repository');
|
||||
|
||||
class NoteRevision extends Entity {
|
||||
static get tableName() { return "note_revisions"; }
|
||||
static get primaryKeyName() { return "noteRevisionId"; }
|
||||
|
||||
constructor(row) {
|
||||
super(row);
|
||||
|
||||
if (this.isProtected) {
|
||||
protected_session.decryptNoteRevision(this);
|
||||
}
|
||||
}
|
||||
|
||||
async getNote() {
|
||||
return this.repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
||||
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
if (this.isProtected) {
|
||||
protected_session.encryptNoteRevision(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user