Added field defaults

This commit is contained in:
Nazar Gargol 2019-11-06 14:44:52 +07:00 committed by Naz Gargol
parent ae14eb00f9
commit 0e822b4d54

View File

@ -1,8 +1,16 @@
const uuid = require('uuid');
const ghostBookshelf = require('./base');
const Email = ghostBookshelf.Model.extend({
tableName: 'emails',
defaults: function defaults() {
return {
uuid: uuid.v4(),
status: 'sending'
};
},
emitChange: function emitChange(event, options) {
const eventToTrigger = 'email' + '.' + event;
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);