mirror of
https://github.com/zadam/trilium.git
synced 2024-09-29 12:05:58 +08:00
34 lines
823 B
JavaScript
34 lines
823 B
JavaScript
"use strict";
|
|
|
|
const Entity = require('./entity');
|
|
const dateUtils = require('../services/date_utils');
|
|
|
|
/**
|
|
* RecentNote represents recently visited note.
|
|
*
|
|
* @param {string} noteId
|
|
* @param {string} notePath
|
|
* @param {boolean} isDeleted
|
|
* @param {string} utcDateModified
|
|
*
|
|
* @extends Entity
|
|
*/
|
|
class RecentNote extends Entity {
|
|
static get entityName() { return "recent_notes"; }
|
|
static get primaryKeyName() { return "noteId"; }
|
|
static get hashedProperties() { return ["noteId", "notePath", "utcDateCreated", "isDeleted"]; }
|
|
|
|
beforeSaving() {
|
|
if (!this.isDeleted) {
|
|
this.isDeleted = false;
|
|
}
|
|
|
|
if (!this.utcDateCreated) {
|
|
this.utcDateCreated = dateUtils.utcNowDateTime();
|
|
}
|
|
|
|
super.beforeSaving();
|
|
}
|
|
}
|
|
|
|
module.exports = RecentNote; |