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:
parent
100ca43460
commit
129c5cbeab
|
|
@ -368,7 +368,7 @@ export class AuthService {
|
||||||
throw new BadRequestException('Invitation has expired');
|
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 {
|
return {
|
||||||
email: invite.email,
|
email: invite.email,
|
||||||
tenantName: tenant?.name || 'Unknown',
|
tenantName: tenant?.name || 'Unknown',
|
||||||
|
|
@ -396,8 +396,8 @@ export class AuthService {
|
||||||
throw new BadRequestException('Invitation has expired');
|
throw new BadRequestException('Invitation has expired');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the tenant to get the slug (used as schema name)
|
// Find the tenant to get the slug (used as schema name); invite.tenantId stores the slug
|
||||||
const tenant = await this.tenantRepository.findOneBy({ id: invite.tenantId });
|
const tenant = await this.tenantRepository.findOneBy({ slug: invite.tenantId });
|
||||||
if (!tenant || tenant.status !== 'active') {
|
if (!tenant || tenant.status !== 'active') {
|
||||||
throw new BadRequestException('Tenant is not active');
|
throw new BadRequestException('Tenant is not active');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue