forked from MergeFi/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.module.ts
More file actions
58 lines (57 loc) · 2.22 KB
/
Copy pathapp.module.ts
File metadata and controls
58 lines (57 loc) · 2.22 KB
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
import { Module } from '@nestjs/common';
import { APP_GUARD } from '@nestjs/core';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
import { ScheduleModule } from '@nestjs/schedule';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import configuration, { AppConfig } from './config/configuration';
import { entities } from './common/entities/typeorm-entities';
import { AuthModule } from './auth/auth.module';
import { UsersModule } from './users/users.module';
import { GithubModule } from './github/github.module';
import { BountiesModule } from './bounties/bounties.module';
import { EscrowModule } from './escrow/escrow.module';
import { TeamsModule } from './teams/teams.module';
import { MilestonesModule } from './milestones/milestones.module';
import { SponsorsModule } from './sponsors/sponsors.module';
import { MaintenancePoolModule } from './maintenance-pool/maintenance-pool.module';
import { ReputationModule } from './reputation/reputation.module';
import { AnalyticsModule } from './analytics/analytics.module';
import { IdempotencyModule } from './common/idempotency/idempotency.module';
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true, load: [configuration] }),
ThrottlerModule.forRoot([{ ttl: 60_000, limit: 120 }]),
ScheduleModule.forRoot(),
TypeOrmModule.forRootAsync({
inject: [ConfigService],
useFactory: (configService: ConfigService<AppConfig, true>) => {
const database = configService.get('database', { infer: true });
return {
type: 'postgres' as const,
url: database.url,
entities,
synchronize: database.synchronize,
logging: database.logging,
};
},
}),
AuthModule,
UsersModule,
GithubModule,
EscrowModule,
BountiesModule,
TeamsModule,
MilestonesModule,
SponsorsModule,
MaintenancePoolModule,
ReputationModule,
AnalyticsModule,
IdempotencyModule,
],
controllers: [AppController],
providers: [AppService, { provide: APP_GUARD, useClass: ThrottlerGuard }],
})
export class AppModule {}