mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 09:56:36 +01:00
smaller refactorings (mostly entitization)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const Entity = require('./entity');
|
||||
const repository = require('../services/repository');
|
||||
const utils = require('../services/utils');
|
||||
|
||||
class NoteImage extends Entity {
|
||||
static get tableName() { return "note_images"; }
|
||||
@@ -10,6 +11,18 @@ class NoteImage extends Entity {
|
||||
async getNote() {
|
||||
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
||||
}
|
||||
|
||||
async getImage() {
|
||||
return await repository.getEntity("SELECT * FROM images WHERE imageId = ?", [this.imageId]);
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
if (!this.dateCreated) {
|
||||
this.dateCreated = utils.nowDate();
|
||||
}
|
||||
|
||||
this.dateModified = utils.nowDate();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NoteImage;
|
||||
Reference in New Issue
Block a user