2026-04-14-8 auth and commercial

This commit is contained in:
Hamza-Ayed
2026-04-14 20:14:48 +03:00
parent be7dcc2652
commit f5b3f9f790
430 changed files with 6074 additions and 751 deletions
+35
View File
@@ -0,0 +1,35 @@
import { Module, Global, OnModuleInit } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AuthService } from './auth.service';
import { Tenant } from './entities/tenant.entity';
import { ApiKey } from './entities/api-key.entity';
import { RedisModule } from '../common/redis.module';
import { ConfigService } from '@nestjs/config';
@Global()
@Module({
imports: [
TypeOrmModule.forFeature([Tenant, ApiKey]),
RedisModule,
],
providers: [AuthService],
exports: [AuthService],
})
export class AuthModule implements OnModuleInit {
constructor(
private readonly authService: AuthService,
private readonly configService: ConfigService,
) {}
/**
* Seed the default API key from environment to prevent breaking current integrations.
* دمج مفتاح الأمان الافتراضي من الإعدادات لمنع توقف الرقابة الحالية
*/
async onModuleInit() {
const defaultKey = this.configService.get<string>('MAP_API_KEY');
if (defaultKey) {
await this.authService.seedDefaultKey('Default System', 'admin@intaleq.xyz', defaultKey);
console.log('✅ Default System API Key seeded successfully');
}
}
}