2018-05-22 00:15:54 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const Entity = require('./entity');
|
2018-05-22 00:22:43 -04:00
|
|
|
const dateUtils = require('../services/date_utils');
|
2018-05-22 00:15:54 -04:00
|
|
|
|
|
|
|
class Option extends Entity {
|
|
|
|
static get tableName() { return "options"; }
|
2018-06-13 19:10:28 -04:00
|
|
|
static get primaryKeyName() { return "name"; }
|
|
|
|
static get hashedProperties() { return ["name", "value"]; }
|
2018-05-22 00:22:43 -04:00
|
|
|
|
2018-08-07 11:38:00 +02:00
|
|
|
constructor(row) {
|
|
|
|
super(row);
|
|
|
|
|
|
|
|
this.isSynced = !!this.isSynced;
|
|
|
|
}
|
|
|
|
|
2018-05-22 00:22:43 -04:00
|
|
|
beforeSaving() {
|
2018-08-06 08:59:26 +02:00
|
|
|
super.beforeSaving();
|
2018-08-12 20:04:48 +02:00
|
|
|
|
|
|
|
if (this.isChanged) {
|
|
|
|
this.dateModified = dateUtils.nowDate();
|
|
|
|
}
|
2018-05-22 00:22:43 -04:00
|
|
|
}
|
2018-05-22 00:15:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Option;
|