12 lines
353 B
JavaScript
12 lines
353 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.creationDate = Date();
|
|
next();
|
|
});
|
|
};
|