refs #5837 if isSocialNameUnique
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
765c22df96
commit
93387cae62
|
@ -42,6 +42,14 @@ module.exports = Self => {
|
|||
|
||||
async function socialNameIsUnique(err, done) {
|
||||
const filter = {
|
||||
include: {
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: {
|
||||
isSocialNameUnique: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
where: {
|
||||
and: [
|
||||
{socialName: this.socialName},
|
||||
|
@ -54,8 +62,8 @@ module.exports = Self => {
|
|||
const existingClient = await Self.app.models.Client.findOne(filter);
|
||||
|
||||
if (existingClient) {
|
||||
console.log(this.isSocialNameUnique);
|
||||
if (!this.isSocialNameUnique && this.socialName === existingClient.socialName)
|
||||
// eslint-disable-next-line max-len
|
||||
if (existingClient.country().isSocialNameUnique && this.socialName === existingClient.socialName)
|
||||
err();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue