From 5cda123a4c529a6f8f869ef82ae48972b8767f62 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Wed, 19 Nov 2025 13:27:10 +0530 Subject: [PATCH] fix test flakes (#25240) --- .github/actions/cache-db/action.yml | 2 +- apps/api/v1/lib/utils/isAdmin.ts | 4 +++- packages/prisma/index.ts | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/actions/cache-db/action.yml b/.github/actions/cache-db/action.yml index 7906afed02..32b9b0c083 100644 --- a/.github/actions/cache-db/action.yml +++ b/.github/actions/cache-db/action.yml @@ -26,7 +26,7 @@ runs: with: path: ${{ inputs.path }} key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.path }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} - - run: USE_POOL=true yarn db-seed + - run: yarn db-seed if: steps.cache-db.outputs.cache-hit != 'true' shell: bash - name: Postgres Dump Backup diff --git a/apps/api/v1/lib/utils/isAdmin.ts b/apps/api/v1/lib/utils/isAdmin.ts index 38f3cc3099..1958ee055f 100644 --- a/apps/api/v1/lib/utils/isAdmin.ts +++ b/apps/api/v1/lib/utils/isAdmin.ts @@ -16,13 +16,15 @@ export const isAdminGuard = async (req: NextApiRequest) => { where: { userId: userId, accepted: true, + role: { + in: [MembershipRole.OWNER, MembershipRole.ADMIN], + }, team: { isOrganization: true, organizationSettings: { isAdminAPIEnabled: true, }, }, - OR: [{ role: MembershipRole.OWNER }, { role: MembershipRole.ADMIN }], }, select: { team: { diff --git a/packages/prisma/index.ts b/packages/prisma/index.ts index 6be7cc3164..1c7a844a55 100644 --- a/packages/prisma/index.ts +++ b/packages/prisma/index.ts @@ -8,9 +8,8 @@ import { excludePendingPaymentsExtension } from "./extensions/exclude-pending-pa import { PrismaClient, type Prisma } from "./generated/prisma/client"; const connectionString = process.env.DATABASE_URL || ""; -const isIntegrationTest = process.env.INTEGRATION_TESTS === "true"; const pool = - !isIntegrationTest && (process.env.USE_POOL === "true" || process.env.USE_POOL === "1") + process.env.USE_POOL === "true" || process.env.USE_POOL === "1" ? new Pool({ connectionString: connectionString, max: 5,