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

12 lines
357 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();
});
};