|
1 |
| -import { CacheModule, Module } from '@nestjs/common'; |
2 |
| -import { AppController } from './app.controller'; |
3 |
| -import { AppService } from './app.service'; |
4 |
| -import { ScheduleModule } from '@nestjs/schedule'; |
5 |
| -import { IngestorModule } from './ingestor/ingestor.module'; |
6 |
| -import { ConfigModule, ConfigService } from '@nestjs/config'; |
7 |
| -import { MikroOrmModule } from '@mikro-orm/nestjs'; |
8 |
| -import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; |
9 |
| -import { DataHistory } from './ingestor/entities/dataHistory.entity'; |
10 |
| -import { PurchaseHistory } from './ingestor/entities/purchaseHistory.entity'; |
11 |
| -import { Tile } from './ingestor/entities/tile.entity'; |
12 |
| -import { TransferHistory } from './ingestor/entities/transferHistory.entity'; |
13 |
| -import { WrappingHistory } from './ingestor/entities/wrappingHistory.entity'; |
14 |
| -import { NotificationsModule } from './notifications/notifications.module'; |
15 |
| -import { RendererModule } from './renderer/renderer.module'; |
16 |
| -import { CurrentState } from './ingestor/entities/currentState.entity'; |
17 |
| -import { MetadataService } from './metadata/metadata.service'; |
18 |
| -import { MetadataModule } from './metadata/metadata.module'; |
19 |
| -import { OpenseaModule } from './opensea/opensea.module'; |
20 |
| -import { SyncToS3Service } from './sync-to-s3/sync-to-s3.service'; |
21 |
| -import { SyncToS3Module } from './sync-to-s3/sync-to-s3.module'; |
22 |
| -import { PixelMapTransaction } from './ingestor/entities/pixelMapTransaction.entity'; |
23 |
| -import { DiscordModule, registerPipeGlobally } from '@discord-nestjs/core'; |
24 |
| -import { TransformPipe } from '@discord-nestjs/common'; |
| 1 | +import { CacheModule, Module } from "@nestjs/common"; |
| 2 | +import { AppController } from "./app.controller"; |
| 3 | +import { AppService } from "./app.service"; |
| 4 | +import { ScheduleModule } from "@nestjs/schedule"; |
| 5 | +import { IngestorModule } from "./ingestor/ingestor.module"; |
| 6 | +import { ConfigModule, ConfigService } from "@nestjs/config"; |
| 7 | +import { MikroOrmModule } from "@mikro-orm/nestjs"; |
| 8 | +import { TsMorphMetadataProvider } from "@mikro-orm/reflection"; |
| 9 | +import { DataHistory } from "./ingestor/entities/dataHistory.entity"; |
| 10 | +import { PurchaseHistory } from "./ingestor/entities/purchaseHistory.entity"; |
| 11 | +import { Tile } from "./ingestor/entities/tile.entity"; |
| 12 | +import { TransferHistory } from "./ingestor/entities/transferHistory.entity"; |
| 13 | +import { WrappingHistory } from "./ingestor/entities/wrappingHistory.entity"; |
| 14 | +import { NotificationsModule } from "./notifications/notifications.module"; |
| 15 | +import { RendererModule } from "./renderer/renderer.module"; |
| 16 | +import { CurrentState } from "./ingestor/entities/currentState.entity"; |
| 17 | +import { MetadataService } from "./metadata/metadata.service"; |
| 18 | +import { MetadataModule } from "./metadata/metadata.module"; |
| 19 | +import { OpenseaModule } from "./opensea/opensea.module"; |
| 20 | +import { SyncToS3Service } from "./sync-to-s3/sync-to-s3.service"; |
| 21 | +import { SyncToS3Module } from "./sync-to-s3/sync-to-s3.module"; |
| 22 | +import { PixelMapTransaction } from "./ingestor/entities/pixelMapTransaction.entity"; |
| 23 | +import { DiscordModule, registerPipeGlobally } from "@discord-nestjs/core"; |
| 24 | +import { TransformPipe } from "@discord-nestjs/common"; |
25 | 25 |
|
26 | 26 | @Module({
|
27 |
| - imports: [ |
28 |
| - CacheModule.register({ isGlobal: true, ttl: 1000000, max: 100000 }), |
29 |
| - ConfigModule.forRoot({ isGlobal: true }), |
30 |
| - ScheduleModule.forRoot(), |
31 |
| - MikroOrmModule.forFeature([Tile, DataHistory, PurchaseHistory]), |
32 |
| - MikroOrmModule.forRootAsync({ |
33 |
| - useFactory: (configService: ConfigService) => ({ |
34 |
| - metadataProvider: TsMorphMetadataProvider, |
35 |
| - entities: [ |
36 |
| - CurrentState, |
37 |
| - DataHistory, |
38 |
| - PurchaseHistory, |
39 |
| - Tile, |
40 |
| - TransferHistory, |
41 |
| - WrappingHistory, |
42 |
| - PixelMapTransaction, |
43 |
| - ], |
44 |
| - type: 'postgresql', |
45 |
| - dbName: configService.get<string>('DATABASE_NAME'), |
46 |
| - host: configService.get<string>('DATABASE_HOST'), |
47 |
| - port: 5432, |
48 |
| - user: configService.get<string>('DATABASE_USERNAME'), |
49 |
| - password: configService.get<string>('DATABASE_PASSWORD'), |
50 |
| - driverOptions: { |
51 |
| - connection: { ssl: { rejectUnauthorized: false } }, |
52 |
| - }, |
53 |
| - }), |
54 |
| - inject: [ConfigService], |
55 |
| - }), |
56 |
| - DiscordModule.forRootAsync({ |
57 |
| - imports: [ConfigModule], |
58 |
| - useFactory: async (configService: ConfigService) => ({ |
59 |
| - token: configService.get<string>('DISCORD_TOKEN'), |
60 |
| - discordClientOptions: { |
61 |
| - intents: ['GUILD_MESSAGES', 'GUILD_MESSAGE_REACTIONS'], |
62 |
| - }, |
63 |
| - commandPrefix: '!', |
64 |
| - allowGuilds: ['745366351929016363'], |
65 |
| - denyGuilds: ['520622812742811698'], |
66 |
| - allowCommands: [ |
67 |
| - { |
68 |
| - name: 'some', |
69 |
| - channels: ['745366352386326572'], |
70 |
| - users: ['261863053329563648'], |
71 |
| - channelType: ['dm'], |
72 |
| - }, |
73 |
| - ], |
74 |
| - // and other discord options |
75 |
| - }), |
76 |
| - inject: [ConfigService], |
77 |
| - }), |
78 |
| - IngestorModule, |
79 |
| - NotificationsModule, |
80 |
| - RendererModule, |
81 |
| - MetadataModule, |
82 |
| - OpenseaModule, |
83 |
| - SyncToS3Module, |
84 |
| - ], |
85 |
| - controllers: [AppController], |
86 |
| - providers: [ |
87 |
| - AppService, |
88 |
| - MetadataService, |
89 |
| - SyncToS3Service, |
90 |
| - { |
91 |
| - provide: registerPipeGlobally(), |
92 |
| - useClass: TransformPipe, |
93 |
| - }, |
94 |
| - ], |
| 27 | + imports: [ |
| 28 | + CacheModule.register({ isGlobal: true, ttl: 1000000, max: 100000 }), |
| 29 | + ConfigModule.forRoot({ isGlobal: true }), |
| 30 | + ScheduleModule.forRoot(), |
| 31 | + MikroOrmModule.forFeature([Tile, DataHistory, PurchaseHistory]), |
| 32 | + MikroOrmModule.forRootAsync({ |
| 33 | + useFactory: (configService: ConfigService) => ({ |
| 34 | + metadataProvider: TsMorphMetadataProvider, |
| 35 | + entities: [ |
| 36 | + CurrentState, |
| 37 | + DataHistory, |
| 38 | + PurchaseHistory, |
| 39 | + Tile, |
| 40 | + TransferHistory, |
| 41 | + WrappingHistory, |
| 42 | + PixelMapTransaction, |
| 43 | + ], |
| 44 | + type: "postgresql", |
| 45 | + dbName: configService.get<string>("DATABASE_NAME"), |
| 46 | + host: configService.get<string>("DATABASE_HOST"), |
| 47 | + port: 5432, |
| 48 | + user: configService.get<string>("DATABASE_USERNAME"), |
| 49 | + password: configService.get<string>("DATABASE_PASSWORD"), |
| 50 | + driverOptions: { |
| 51 | + connection: { ssl: { rejectUnauthorized: false } }, |
| 52 | + }, |
| 53 | + }), |
| 54 | + inject: [ConfigService], |
| 55 | + }), |
| 56 | + DiscordModule.forRootAsync({ |
| 57 | + imports: [ConfigModule], |
| 58 | + useFactory: async (configService: ConfigService) => ({ |
| 59 | + token: configService.get<string>("DISCORD_TOKEN"), |
| 60 | + discordClientOptions: { |
| 61 | + intents: ["GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS"], |
| 62 | + }, |
| 63 | + commandPrefix: "!", |
| 64 | + allowGuilds: ["745366351929016363"], |
| 65 | + denyGuilds: ["520622812742811698"], |
| 66 | + allowCommands: [ |
| 67 | + { |
| 68 | + name: "some", |
| 69 | + channels: ["745366352386326572"], |
| 70 | + users: ["261863053329563648"], |
| 71 | + channelType: ["dm"], |
| 72 | + }, |
| 73 | + ], |
| 74 | + // and other discord options |
| 75 | + }), |
| 76 | + inject: [ConfigService], |
| 77 | + }), |
| 78 | + IngestorModule, |
| 79 | + NotificationsModule, |
| 80 | + RendererModule, |
| 81 | + MetadataModule, |
| 82 | + OpenseaModule, |
| 83 | + SyncToS3Module, |
| 84 | + ], |
| 85 | + controllers: [AppController], |
| 86 | + providers: [ |
| 87 | + AppService, |
| 88 | + MetadataService, |
| 89 | + SyncToS3Service, |
| 90 | + { |
| 91 | + provide: registerPipeGlobally(), |
| 92 | + useClass: TransformPipe, |
| 93 | + }, |
| 94 | + ], |
95 | 95 | })
|
96 | 96 | export class AppModule {}
|
0 commit comments