salix/services/client/common/models/ClientObservation.js

13 lines
386 B
JavaScript

module.exports = function(ClientObservation) {
ClientObservation.validate('text', isEnabled, {message: 'Se debe rellenar el campo de texto'});
function isEnabled(err) {
if (!this.text) err();
}
ClientObservation.observe('before save', function(ctx, next) {
ctx.instance.created = Date();
ctx.instance.employeeFk = 20;
next();
});
};