Added message for duplicated names
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
5972526327
commit
63ac492845
|
@ -174,5 +174,7 @@
|
|||
"That item doesn't exists": "Ese artículo no existe",
|
||||
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
|
||||
"Invalid account": "Cuenta inválida",
|
||||
"Compensation account is empty": "La cuenta para compensar está vacia"
|
||||
"Compensation account is empty": "La cuenta para compensar está vacia",
|
||||
"This genus already exist": "Este genus ya existe",
|
||||
"This specie already exist": "Esta especie ya existe"
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = Self => {
|
||||
Self.validatesPresenceOf('name', {
|
||||
message: 'Name cannot be blank'
|
||||
});
|
||||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
Self.validatesUniquenessOf('id', {
|
||||
message: 'This name already exist.'
|
||||
module.exports = Self => {
|
||||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(`This genus already exist`);
|
||||
return err;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
let UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(`This specie already exist`);
|
||||
return err;
|
||||
});
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
module.exports = Self => {
|
||||
Self.validatesPresenceOf('name', {
|
||||
message: 'Name cannot be blank'
|
||||
});
|
||||
|
||||
Self.validatesUniquenessOf('id', {
|
||||
message: 'This name already exist.'
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue