diff --git a/packages/services/auth-service/src/application/services/auth.service.ts b/packages/services/auth-service/src/application/services/auth.service.ts index 3759340..becd790 100644 --- a/packages/services/auth-service/src/application/services/auth.service.ts +++ b/packages/services/auth-service/src/application/services/auth.service.ts @@ -368,7 +368,7 @@ export class AuthService { throw new BadRequestException('Invitation has expired'); } - const tenant = await this.tenantRepository.findOneBy({ id: invite.tenantId }); + const tenant = await this.tenantRepository.findOneBy({ slug: invite.tenantId }); return { email: invite.email, tenantName: tenant?.name || 'Unknown', @@ -396,8 +396,8 @@ export class AuthService { throw new BadRequestException('Invitation has expired'); } - // Find the tenant to get the slug (used as schema name) - const tenant = await this.tenantRepository.findOneBy({ id: invite.tenantId }); + // Find the tenant to get the slug (used as schema name); invite.tenantId stores the slug + const tenant = await this.tenantRepository.findOneBy({ slug: invite.tenantId }); if (!tenant || tenant.status !== 'active') { throw new BadRequestException('Tenant is not active'); }