validacion prueba

This commit is contained in:
Javi Gallego 2017-01-12 11:02:22 +01:00
parent a52ffbc9a3
commit 4d9e3d2684
9 changed files with 25 additions and 10 deletions

View File

@ -9,15 +9,15 @@
}, },
"street": { "street": {
"type": "string", "type": "string",
"required": "true" "required": true
}, },
"consignee": { "consignee": {
"type": "string", "type": "string",
"required": "true" "required": true
}, },
"city": { "city": {
"type": "string", "type": "string",
"required": "true" "required": true
}, },
"postcode": { "postcode": {
"type": "string" "type": "string"

View File

@ -9,7 +9,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
} }
} }
} }

View File

@ -0,0 +1,14 @@
module.exports = function(Client) {
// prueba uno
// Client.validatesUniquenessOf('name', {message: 'el nombre debe ser unico'});
// prueba dos
Client.validate('name',hasCC,{message: 'Introducir cuenta bancaria'});
function hasCC(err) {
if (this.payMethod == 2) err();
}
};

View File

@ -1,6 +1,7 @@
{ {
"name": "Client", "name": "Client",
"base": "PersistedModel", "base": "PersistedModel",
"validateUpsert": true,
"properties": { "properties": {
"id": { "id": {
"type": "Number", "type": "Number",
@ -9,7 +10,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
}, },
"fi": { "fi": {
"type": "string", "type": "string",

View File

@ -9,7 +9,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
} }
} }
} }

View File

@ -9,7 +9,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
} }
} }
} }

View File

@ -9,7 +9,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
} }
} }
} }

View File

@ -9,7 +9,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
} }
} }
} }

View File

@ -9,7 +9,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"required": "true" "required": true
}, },
"active": { "active": {
"type": "boolean" "type": "boolean"