refs #5837 new table
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-07-14 11:30:13 +02:00
parent 6d8b3e346d
commit 765c22df96
4 changed files with 13 additions and 2 deletions

View File

@ -22,6 +22,9 @@
}, },
"isUeeMember": { "isUeeMember": {
"type": "boolean" "type": "boolean"
},
"isSocialNameUnique": {
"type": "boolean"
} }
}, },
"relations": { "relations": {
@ -39,4 +42,4 @@
"permission": "ALLOW" "permission": "ALLOW"
} }
] ]
} }

View File

@ -0,0 +1,2 @@
ALTER TABLE `vn`.`country`
ADD COLUMN `isSocialNameUnique` tinyint(1) NOT NULL DEFAULT 1;

View File

@ -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();
} }

View File

@ -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",