2018-04-01 12:03:21 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const Entity = require('./entity');
|
2018-05-26 12:38:25 -04:00
|
|
|
const dateUtils = require('../services/date_utils');
|
2018-04-01 12:03:21 -04:00
|
|
|
|
2018-08-22 23:37:06 +02:00
|
|
|
/**
|
|
|
|
* RecentNote represents recently visited note.
|
|
|
|
*
|
2019-11-09 09:36:08 +01:00
|
|
|
* @property {string} noteId
|
|
|
|
* @property {string} notePath
|
2021-02-12 22:39:38 +01:00
|
|
|
* @property {string} utcDateCreated
|
2018-08-22 23:37:06 +02:00
|
|
|
*
|
|
|
|
* @extends Entity
|
|
|
|
*/
|
2018-04-01 12:03:21 -04:00
|
|
|
class RecentNote extends Entity {
|
2018-08-16 23:00:04 +02:00
|
|
|
static get entityName() { return "recent_notes"; }
|
2019-05-21 21:47:28 +02:00
|
|
|
static get primaryKeyName() { return "noteId"; }
|
2018-05-26 12:38:25 -04:00
|
|
|
|
|
|
|
beforeSaving() {
|
2019-03-12 20:58:31 +01:00
|
|
|
if (!this.utcDateCreated) {
|
2019-03-13 22:43:59 +01:00
|
|
|
this.utcDateCreated = dateUtils.utcNowDateTime();
|
2018-05-26 12:38:25 -04:00
|
|
|
}
|
2018-08-06 08:59:26 +02:00
|
|
|
|
|
|
|
super.beforeSaving();
|
2018-05-26 12:38:25 -04:00
|
|
|
}
|
2018-04-01 12:03:21 -04:00
|
|
|
}
|
|
|
|
|
2021-02-12 22:39:38 +01:00
|
|
|
module.exports = RecentNote;
|