Fix Dashboard 404, missing Invoices table, and account limits
This commit is contained in:
@@ -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,
|
||||
|
||||
21
backend/src/modules/dashboard/dashboard.module.ts
Normal file
21
backend/src/modules/dashboard/dashboard.module.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* ════════════════════════════════════════════════════════════
|
||||
* مُصادَق (Musadaq) — Dashboard Module
|
||||
* ════════════════════════════════════════════════════════════
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { DashboardService } from './dashboard.service';
|
||||
import { DashboardController } from './dashboard.controller';
|
||||
import { Invoice } from '../invoices/entities/invoice.entity';
|
||||
import { Company } from '../companies/entities/company.entity';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([Invoice, Company]),
|
||||
],
|
||||
controllers: [DashboardController],
|
||||
providers: [DashboardService],
|
||||
})
|
||||
export class DashboardModule {}
|
||||
Reference in New Issue
Block a user