This commit is contained in:
parent
6d8b3e346d
commit
765c22df96
|
@ -22,6 +22,9 @@
|
|||
},
|
||||
"isUeeMember": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isSocialNameUnique": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"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);
|
||||
|
||||
if (existingClient) {
|
||||
if (this.countryFk !== 19 && this.socialName === existingClient.socialName)
|
||||
console.log(this.isSocialNameUnique);
|
||||
if (!this.isSocialNameUnique && this.socialName === existingClient.socialName)
|
||||
err();
|
||||
}
|
||||
|
||||
|
|
|
@ -181,6 +181,11 @@
|
|||
"model": "Country",
|
||||
"foreignKey": "countryFk"
|
||||
},
|
||||
"isSocialNameUnique": {
|
||||
"type": "belongsTo",
|
||||
"model": "Country",
|
||||
"foreignKey": "countryFk"
|
||||
},
|
||||
"contactChannel": {
|
||||
"type": "belongsTo",
|
||||
"model": "ContactChannel",
|
||||
|
|
Loading…
Reference in New Issue