This commit is contained in:
parent
6d8b3e346d
commit
765c22df96
|
@ -22,6 +22,9 @@
|
||||||
},
|
},
|
||||||
"isUeeMember": {
|
"isUeeMember": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"isSocialNameUnique": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE `vn`.`country`
|
||||||
|
ADD COLUMN `isSocialNameUnique` tinyint(1) NOT NULL DEFAULT 1;
|
|
@ -54,7 +54,8 @@ module.exports = Self => {
|
||||||
const existingClient = await Self.app.models.Client.findOne(filter);
|
const existingClient = await Self.app.models.Client.findOne(filter);
|
||||||
|
|
||||||
if (existingClient) {
|
if (existingClient) {
|
||||||
if (this.countryFk !== 19 && this.socialName === existingClient.socialName)
|
console.log(this.isSocialNameUnique);
|
||||||
|
if (!this.isSocialNameUnique && this.socialName === existingClient.socialName)
|
||||||
err();
|
err();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,11 @@
|
||||||
"model": "Country",
|
"model": "Country",
|
||||||
"foreignKey": "countryFk"
|
"foreignKey": "countryFk"
|
||||||
},
|
},
|
||||||
|
"isSocialNameUnique": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Country",
|
||||||
|
"foreignKey": "countryFk"
|
||||||
|
},
|
||||||
"contactChannel": {
|
"contactChannel": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "ContactChannel",
|
"model": "ContactChannel",
|
||||||
|
|
Loading…
Reference in New Issue