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 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-07 04:26:21 -08:00
parent 100ca43460
commit 129c5cbeab
1 changed files with 3 additions and 3 deletions

View File

@ -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');
}