refs #7004 fix: move validation to required method
This commit is contained in:
parent
01cd2709cc
commit
726c9d3266
|
@ -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,
|
||||
|
|
|
@ -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'
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue