2018-04-02 00:03:21 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const Entity = require('./entity');
|
2018-05-27 00:38:25 +08:00
|
|
|
const dateUtils = require('../services/date_utils');
|
2018-04-02 00:03:21 +08:00
|
|
|
|
|
|
|
class RecentNote extends Entity {
|
|
|
|
static get tableName() { return "recent_notes"; }
|
|
|
|
static get primaryKeyName() { return "branchId"; }
|
2018-05-27 00:38:25 +08:00
|
|
|
static get hashedProperties() { return ["branchId", "notePath", "dateCreated", "isDeleted"]; }
|
|
|
|
|
|
|
|
beforeSaving() {
|
|
|
|
super.beforeSaving();
|
|
|
|
|
|
|
|
if (!this.isDeleted) {
|
|
|
|
this.isDeleted = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.dateCreated) {
|
|
|
|
this.dateCreated = dateUtils.nowDate();
|
|
|
|
}
|
|
|
|
}
|
2018-04-02 00:03:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = RecentNote;
|