fix: isDomainConfigured

This commit is contained in:
Andras Bacsai
2022-02-15 18:04:58 +01:00
parent b04d75ab08
commit b29c1e702a
2 changed files with 3 additions and 5 deletions

View File

@@ -22,15 +22,15 @@ export async function isSecretExists({ id, name }) {
export async function isDomainConfigured({ id, fqdn }) {
const domain = getDomain(fqdn);
const foundApp = await prisma.application.findFirst({
where: { fqdn: { endsWith: domain }, id: { not: id } },
where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
select: { fqdn: true }
});
const foundService = await prisma.service.findFirst({
where: { fqdn: { endsWith: domain }, id: { not: id } },
where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
select: { fqdn: true }
});
const coolifyFqdn = await prisma.setting.findFirst({
where: { fqdn: { endsWith: domain }, id: { not: id } },
where: { fqdn: { endsWith: `//${domain}` }, id: { not: id } },
select: { fqdn: true }
});
if (foundApp || foundService || coolifyFqdn) return true;