All files / src app.module.ts

100% Statements 1/1
100% Branches 4/4
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66                                                7x                                                                                  
import { Module } from '@nestjs/common'
import { AuthModule } from './features/auth/auth.module'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { EventsModule } from './features/events/events.module'
import { GatewayModule } from './features/gateway/gateway.module'
import { DatabaseModule } from './database/database.module'
import { DonationModule } from './features/donation/donation.module'
import { QueueModule } from './features/queue/queue.module'
import { MailModule } from './features/mail/mail.module'
import { ExportModule } from './features/export/export.module'
import { StaffModule } from './features/staff/staff.module'
import { APP_GUARD } from '@nestjs/core'
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler'
import { ThrottlerStorageRedisService } from '@nest-lab/throttler-storage-redis'
import Redis from 'ioredis'
 
import { WhiteLabelingModule } from './features/white-labeling/white-labeling.module'
import { HealthModule } from './features/health/health.module'
 
@Module({
    imports: [
        ThrottlerModule.forRootAsync({
            imports: [ConfigModule],
            inject: [ConfigService],
            useFactory: (config: ConfigService) => ({
                throttlers: [
                    {
                        ttl: 60000,
                        limit: 1000, // Increased for E2E tests
                    },
                ],
                storage: new ThrottlerStorageRedisService(
                    new Redis({
                        host: config.get('REDIS_HOST') || 'localhost',
                        port: parseInt(config.get('REDIS_PORT') || '6379'),
                    }),
                ),
            }),
        }),
        ConfigModule.forRoot({
            isGlobal: true,
            envFilePath: ['.env.test', '.env'],
        }),
 
        DatabaseModule,
        AuthModule,
        EventsModule,
        GatewayModule,
        DonationModule,
        MailModule,
        QueueModule,
        ExportModule,
        StaffModule,
        WhiteLabelingModule,
        HealthModule,
    ],
    controllers: [],
    providers: [
        {
            provide: APP_GUARD,
            useClass: ThrottlerGuard,
        },
    ],
})
export class AppModule {}