94 lines
2.4 KiB
TypeScript
94 lines
2.4 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
|
|
import { APP_GUARD } from '@nestjs/core';
|
|
import { ScheduleModule } from '@nestjs/schedule';
|
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
|
|
|
import { configuration } from './config';
|
|
import { PrismaModule } from './prisma';
|
|
import { AuthModule, JwtAuthGuard, RolesGuard } from './auth';
|
|
import { UsersModule } from './users';
|
|
import { EmailModule } from './email';
|
|
import { AgentTypesModule } from './agent-types';
|
|
import { AgentsModule } from './agents';
|
|
import { UploadModule } from './upload';
|
|
import { ProfileFieldsModule } from './profile-fields';
|
|
import { ConnectionRequestsModule } from './connection-requests';
|
|
import { MessagesModule } from './messages';
|
|
import { CmsModule } from './cms';
|
|
import { NotificationsModule } from './notifications';
|
|
import { TestimonialsModule } from './testimonials';
|
|
import { SupportChatModule } from './support-chat';
|
|
import { UserReportsModule } from './user-reports';
|
|
import { ContactModule } from './contact';
|
|
import { StripeModule } from './stripe';
|
|
import { AppController } from './app.controller';
|
|
import { AppService } from './app.service';
|
|
|
|
@Module({
|
|
imports: [
|
|
// Configuration
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
load: [configuration],
|
|
envFilePath: ['.env.local', '.env'],
|
|
}),
|
|
|
|
// Rate Limiting
|
|
ThrottlerModule.forRoot([
|
|
{
|
|
ttl: 60000, // 60 seconds
|
|
limit: 100, // 100 requests per minute
|
|
},
|
|
]),
|
|
|
|
// Task Scheduling
|
|
ScheduleModule.forRoot(),
|
|
|
|
// Event Emitter
|
|
EventEmitterModule.forRoot(),
|
|
|
|
// Database
|
|
PrismaModule,
|
|
|
|
// Feature Modules
|
|
AuthModule,
|
|
UsersModule,
|
|
EmailModule,
|
|
AgentTypesModule,
|
|
AgentsModule,
|
|
UploadModule,
|
|
ProfileFieldsModule,
|
|
ConnectionRequestsModule,
|
|
MessagesModule,
|
|
CmsModule,
|
|
NotificationsModule,
|
|
TestimonialsModule,
|
|
SupportChatModule,
|
|
UserReportsModule,
|
|
ContactModule,
|
|
StripeModule,
|
|
],
|
|
controllers: [AppController],
|
|
providers: [
|
|
AppService,
|
|
// Global Rate Limiting Guard
|
|
{
|
|
provide: APP_GUARD,
|
|
useClass: ThrottlerGuard,
|
|
},
|
|
// Global JWT Auth Guard
|
|
{
|
|
provide: APP_GUARD,
|
|
useClass: JwtAuthGuard,
|
|
},
|
|
// Global Roles Guard
|
|
{
|
|
provide: APP_GUARD,
|
|
useClass: RolesGuard,
|
|
},
|
|
],
|
|
})
|
|
export class AppModule {}
|