Fix Dashboard 404, missing Invoices table, and account limits

This commit is contained in:
Hamza-Ayed
2026-04-18 01:28:24 +03:00
parent 2e18020e49
commit 9756adfaae
4 changed files with 35 additions and 2 deletions

View File

@@ -109,6 +109,16 @@ export class AuthService {
throw new UnauthorizedException('Invalid credentials');
}
// ── Self-Healing: Upgrade old trial accounts to unlimited companies ──
try {
await this.dataSource.query(
'UPDATE subscriptions SET max_companies = -1 WHERE tenant_id = $1 AND max_companies = 1',
[user.tenant_id],
);
} catch (e) {
console.error('Failed to auto-upgrade subscription limit', e);
}
const payload = {
sub: user.id,
tenantId: user.tenant_id,