add checks to the existence of object variables
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2022-10-17 07:35:02 +02:00
parent dc6c8f924d
commit 594cee12f3
1 changed files with 10 additions and 6 deletions

View File

@ -20,13 +20,17 @@ module.exports = Self => {
message: 'The supplier name must be unique'
});
if (this.city) {
Self.validatesPresenceOf('city', {
message: 'City cannot be empty'
});
}
if (this.nif) {
Self.validatesPresenceOf('nif', {
message: 'The nif cannot be empty'
});
}
Self.validatesUniquenessOf('nif', {
message: 'TIN must be unique'