fix: use underscores in tenant slug for valid PostgreSQL schema names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-22 03:23:14 -08:00
parent 34caa25c71
commit 7ff012cd91
1 changed files with 3 additions and 3 deletions

View File

@ -141,11 +141,11 @@ export class AuthService {
name: string, name: string,
companyName: string, companyName: string,
) { ) {
// Generate slug from company name // Generate slug from company name (underscores for valid PostgreSQL schema names)
const slug = companyName const slug = companyName
.toLowerCase() .toLowerCase()
.replace(/[^a-z0-9]+/g, '-') .replace(/[^a-z0-9]+/g, '_')
.replace(/(^-|-$)/g, '') .replace(/(^_|_$)/g, '')
.slice(0, 40); .slice(0, 40);
// Check slug uniqueness // Check slug uniqueness