From 2d7fb8e23a5ed7cce79752ccf3075de4a01abe49 Mon Sep 17 00:00:00 2001 From: mirarifhasan Date: Wed, 31 Jan 2024 17:29:40 +0600 Subject: [PATCH] fix: pnpm issue --- .../src/infra-config/helper.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/hoppscotch-backend/src/infra-config/helper.ts b/packages/hoppscotch-backend/src/infra-config/helper.ts index b1892626f..76a8acf83 100644 --- a/packages/hoppscotch-backend/src/infra-config/helper.ts +++ b/packages/hoppscotch-backend/src/infra-config/helper.ts @@ -1,5 +1,8 @@ import { AuthProvider } from 'src/auth/helper'; -import { AUTH_PROVIDER_NOT_CONFIGURED } from 'src/errors'; +import { + AUTH_PROVIDER_NOT_CONFIGURED, + DATABASE_TABLE_NOT_EXIST, +} from 'src/errors'; import { PrismaService } from 'src/prisma/prisma.service'; import { InfraConfigEnum } from 'src/types/InfraConfig'; import { throwErr } from 'src/utils'; @@ -159,19 +162,22 @@ export async function getDefaultInfraConfigs(): Promise< */ export async function isInfraConfigTablePopulated(): Promise { const prisma = new PrismaService(); + try { + const infraConfigCountInDB = await prisma.infraConfig.count(); + const infraConfigCountShouldBe = getDefaultInfraConfigs().length; - const infraConfigCountInDB = await prisma.infraConfig.count(); - const infraConfigCountShouldBe = getDefaultInfraConfigs().length; + const isPopulated = infraConfigCountInDB === infraConfigCountShouldBe; - const isPopulated = infraConfigCountInDB === infraConfigCountShouldBe; + if (!isPopulated) { + console.log( + 'Infra Config table is not populated with all entries. Populating now...', + ); + } - if (!isPopulated) { - console.log( - 'Infra Config table is not populated with all entries. Populating now...', - ); + return isPopulated; + } catch (error) { + return false; } - - return isPopulated; } /**