From 7ae826eb717791ce5b96994ba4f93b389e2d93c5 Mon Sep 17 00:00:00 2001 From: Mhd Zayd Skaff Date: Thu, 24 Jul 2025 10:01:42 +0300 Subject: [PATCH] remove space join if not required --- src/community/services/community.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/community/services/community.service.ts b/src/community/services/community.service.ts index f1b7274..54516fb 100644 --- a/src/community/services/community.service.ts +++ b/src/community/services/community.service.ts @@ -187,12 +187,14 @@ export class CommunityService { const matchingCommunityIdsQb = this.communityRepository .createQueryBuilder('c') .select('c.uuid') - .leftJoin('c.spaces', 'space') .where('c.project = :projectUuid', { projectUuid }) .andWhere('c.name != :orphanCommunityName', { orphanCommunityName: `${ORPHAN_COMMUNITY_NAME}-${project.name}`, }) .distinct(true); + if (includeSpaces) { + matchingCommunityIdsQb.leftJoin('c.spaces', 'space'); + } if (search) { matchingCommunityIdsQb