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

12 lines
357 B
JavaScript
Raw Normal View History

2017-01-18 13:48:35 +00:00
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();
});
};