From b171c37cbb90bda2182bb8c2cff7aaed5038ddd1 Mon Sep 17 00:00:00 2001 From: Weiko Date: Tue, 3 Dec 2024 21:43:09 +0100 Subject: [PATCH] fix missing relation --- .../service/domain-manager.service.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/domain-manager/service/domain-manager.service.ts b/packages/twenty-server/src/engine/core-modules/domain-manager/service/domain-manager.service.ts index bc59918278aa..626fb75f2fb0 100644 --- a/packages/twenty-server/src/engine/core-modules/domain-manager/service/domain-manager.service.ts +++ b/packages/twenty-server/src/engine/core-modules/domain-manager/service/domain-manager.service.ts @@ -4,17 +4,16 @@ import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; -import { isDefined } from 'src/utils/is-defined'; +import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; import { WorkspaceException, WorkspaceExceptionCode, } from 'src/engine/core-modules/workspace/workspace.exception'; -import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { isWorkEmail } from 'src/utils/is-work-email'; import { getDomainNameByEmail } from 'src/utils/get-domain-name-by-email'; +import { isDefined } from 'src/utils/is-defined'; +import { isWorkEmail } from 'src/utils/is-work-email'; @Injectable() -// eslint-disable-next-line @nx/workspace-inject-workspace-repository export class DomainManagerService { constructor( @InjectRepository(Workspace, 'core') @@ -126,6 +125,7 @@ export class DomainManagerService { order: { createdAt: 'DESC', }, + relations: ['workspaceSSOIdentityProviders'], }); if (workspaces.length > 1) { @@ -153,7 +153,12 @@ export class DomainManagerService { if (!isDefined(subdomain)) return; - return this.workspaceRepository.findOneBy({ subdomain }); + const workspace = await this.workspaceRepository.findOne({ + where: { subdomain }, + relations: ['workspaceSSOIdentityProviders'], + }); + + return workspace; } catch (e) { throw new WorkspaceException( 'Workspace not found',