trilium/src/entities/option.js

37 lines
849 B
JavaScript
Raw Normal View History

"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
2018-08-23 05:37:06 +08:00
/**
* Option represents name-value pair, either directly configurable by the user or some system property.
*
* @param {string} name
* @param {string} value
* @param {boolean} isSynced
* @param {string} dateModified
* @param {string} dateCreated
*
* @extends Entity
*/
class Option extends Entity {
static get entityName() { return "options"; }
2018-06-14 07:10:28 +08:00
static get primaryKeyName() { return "name"; }
static get hashedProperties() { return ["name", "value"]; }
constructor(row) {
super(row);
this.isSynced = !!this.isSynced;
}
beforeSaving() {
super.beforeSaving();
if (this.isChanged) {
this.dateModified = dateUtils.nowDate();
}
}
}
module.exports = Option;