Files
Trilium/src/entities/branch.js
2018-04-02 20:46:46 -04:00

26 lines
633 B
JavaScript

"use strict";
const Entity = require('./entity');
const dateUtils = require('../services/date_utils');
const repository = require('../services/repository');
class Branch extends Entity {
static get tableName() { return "branches"; }
static get primaryKeyName() { return "branchId"; }
async getNote() {
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
}
beforeSaving() {
super.beforeSaving();
if (!this.isDeleted) {
this.isDeleted = false;
}
this.dateModified = dateUtils.nowDate()
}
}
module.exports = Branch;