2018-03-14 10:36:57 +00:00
|
|
|
module.exports = function(Self) {
|
|
|
|
require('../methods/creditInsurance/filter.js')(Self);
|
|
|
|
|
2018-03-26 09:43:17 +00:00
|
|
|
Self.validateCredit = function(credit) {
|
|
|
|
return credit >= 0;
|
|
|
|
};
|
|
|
|
|
2018-03-14 10:36:57 +00:00
|
|
|
Self.validateBinded('credit', Self.validateCredit, {
|
|
|
|
message: 'The credit must be an integer greater than or equal to zero',
|
|
|
|
allowNull: false, // FIXME: Ignored by loopback when it's false
|
|
|
|
allowBlank: false
|
|
|
|
});
|
|
|
|
|
2018-03-26 09:43:17 +00:00
|
|
|
Self.validateGrade = function(grade) {
|
|
|
|
return typeof grade === 'undefined' || grade >= 0;
|
2018-03-14 10:36:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Self.validateBinded('grade', Self.validateGrade, {
|
|
|
|
message: 'The grade must be an integer greater than or equal to zero',
|
|
|
|
allowNull: true
|
|
|
|
});
|
|
|
|
};
|