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) {
|
async function socialNameIsUnique(err, done) {
|
||||||
const filter = {
|
const filter = {
|
||||||
|
include: {
|
||||||
|
relation: 'country',
|
||||||
|
scope: {
|
||||||
|
fields: {
|
||||||
|
isSocialNameUnique: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
where: {
|
where: {
|
||||||
and: [
|
and: [
|
||||||
{socialName: this.socialName},
|
{socialName: this.socialName},
|
||||||
|
@ -54,8 +62,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) {
|
||||||
console.log(this.isSocialNameUnique);
|
// eslint-disable-next-line max-len
|
||||||
if (!this.isSocialNameUnique && this.socialName === existingClient.socialName)
|
if (existingClient.country().isSocialNameUnique && this.socialName === existingClient.socialName)
|
||||||
err();
|
err();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue