refs #7004 fix: move validation to required method

This commit is contained in:
Javier Segarra 2024-03-08 06:39:23 +01:00
parent 01cd2709cc
commit 726c9d3266
2 changed files with 8 additions and 9 deletions

View File

@ -87,6 +87,14 @@ module.exports = Self => {
}
}
if (!city) {
throw new UserError('The city cannot be empty'
);
}
if (!nif) {
throw new UserError('The nif cannot be empty'
);
}
return supplier.updateAttributes({
name,
nif,

View File

@ -16,15 +16,6 @@ module.exports = Self => {
Self.validatesPresenceOf('name', {
message: 'The social name cannot be empty'
});
Self.validatesPresenceOf('city', {
message: 'City cannot be empty'
});
Self.validatesPresenceOf('nif', {
message: 'The nif cannot be empty'
});
Self.validatesUniquenessOf('nif', {
message: 'TIN must be unique'
});