From 129c5cbeab6e0a249cc800c372ed7ceae0329f92 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 7 Mar 2026 04:26:21 -0800 Subject: [PATCH] fix(auth): use slug lookup for tenant in validateInvite and acceptInvite invite.tenantId stores the slug (not UUID), so findOneBy must use { slug } Co-Authored-By: Claude Sonnet 4.6 --- .../auth-service/src/application/services/auth.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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'); }