Skip to content

Commit

Permalink
fix missing relation
Browse files Browse the repository at this point in the history
  • Loading branch information
Weiko committed Dec 3, 2024
1 parent 1e967d7 commit b171c37
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -126,6 +125,7 @@ export class DomainManagerService {
order: {
createdAt: 'DESC',
},
relations: ['workspaceSSOIdentityProviders'],
});

if (workspaces.length > 1) {
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit b171c37

Please sign in to comment.