mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
37 lines
849 B
JavaScript
37 lines
849 B
JavaScript
"use strict";
|
|
|
|
const Entity = require('./entity');
|
|
const dateUtils = require('../services/date_utils');
|
|
|
|
/**
|
|
* 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"; }
|
|
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; |