Notes/src/entities/branch.js

26 lines
620 B
JavaScript
Raw Normal View History

2018-03-24 21:39:15 -04:00
"use strict";
const Entity = require('./entity');
2018-03-31 22:15:06 -04:00
const utils = require('../services/utils');
2018-03-31 23:08:22 -04:00
const repository = require('../services/repository');
2018-03-24 21:39:15 -04:00
class Branch extends Entity {
static get tableName() { return "branches"; }
static get primaryKeyName() { return "branchId"; }
2018-03-31 22:15:06 -04:00
2018-03-31 23:08:22 -04:00
async getNote() {
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
}
2018-03-31 22:15:06 -04:00
beforeSaving() {
2018-04-02 20:30:00 -04:00
super.beforeSaving();
2018-04-01 17:38:24 -04:00
if (!this.isDeleted) {
this.isDeleted = false;
}
2018-03-31 22:15:06 -04:00
this.dateModified = utils.nowDate()
}
2018-03-24 21:39:15 -04:00
}
module.exports = Branch;