trilium/src/entities/image.js

26 lines
676 B
JavaScript
Raw Normal View History

"use strict";
const Entity = require('./entity');
2018-04-03 08:46:46 +08:00
const dateUtils = require('../services/date_utils');
class Image extends Entity {
static get tableName() { return "images"; }
static get primaryKeyName() { return "imageId"; }
static get syncedProperties() { return ["imageId", "format", "checksum", "name", "isDeleted", "dateModified", "dateCreated"]; }
beforeSaving() {
2018-04-03 08:30:00 +08:00
super.beforeSaving();
2018-04-02 05:38:24 +08:00
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.dateCreated) {
2018-04-03 08:46:46 +08:00
this.dateCreated = dateUtils.nowDate();
}
2018-04-03 08:46:46 +08:00
this.dateModified = dateUtils.nowDate();
}
}
module.exports = Image;