From 5fd3938742ce9c61f4e7fe4b3a5f9342852625ff Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Wed, 13 Nov 2024 12:14:53 +0000 Subject: [PATCH] Improve autocomplete search for organizations --- backend/src/database/repositories/organizationRepository.ts | 4 +++- backend/src/services/organizationService.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/database/repositories/organizationRepository.ts b/backend/src/database/repositories/organizationRepository.ts index 2de5c28c31..ba2473fa79 100644 --- a/backend/src/database/repositories/organizationRepository.ts +++ b/backend/src/database/repositories/organizationRepository.ts @@ -1685,7 +1685,9 @@ class OrganizationRepository { ? ` INNER JOIN "organizationSegmentsAgg" osa ON osa."organizationId" = o.id AND ${ segmentId ? `osa."segmentId" = $(segmentId)` : `osa."segmentId" IS NULL` }` - : '' + : ` LEFT JOIN "organizationSegmentsAgg" osa ON osa."organizationId" = o.id AND ${ + segmentId ? `osa."segmentId" = $(segmentId)` : `osa."segmentId" IS NULL` + }` } WHERE 1=1 AND o."tenantId" = $(tenantId) diff --git a/backend/src/services/organizationService.ts b/backend/src/services/organizationService.ts index 492928cdf5..7e94e87a8d 100644 --- a/backend/src/services/organizationService.ts +++ b/backend/src/services/organizationService.ts @@ -1022,7 +1022,7 @@ export default class OrganizationService extends LoggerBase { offset, segmentId: segments.length > 0 ? segments[0] : undefined, fields: ['id', 'segmentId', 'displayName', 'memberCount', 'activityCount', 'logo'], - include: { aggregates: true, identities: false, lfxMemberships: true }, + include: { aggregates: false, identities: false, lfxMemberships: true }, }, this.options, )