1+ import { BullModule } from '@nestjs/bullmq' ;
12import { Module } from '@nestjs/common' ;
23import { ConfigModule , ConfigService } from '@nestjs/config' ;
34import { ScheduleModule } from '@nestjs/schedule' ;
@@ -6,13 +7,28 @@ import { CacheWarmingModule } from './cache-warming/cache-warming.module';
67import { CacheJob } from './cache-warming/entities/cache-job.entity' ;
78import { Metric } from './cache-warming/entities/metric.entity' ;
89import { PreloadData } from './cache-warming/entities/preload-data.entity' ;
10+ import { DeadLetterEvent } from './events/dead-letter-event.entity' ;
11+ import { Event } from './events/event.entity' ;
12+ import { EventsModule } from './events/events.module' ;
13+ import { JobsModule } from './jobs/jobs.module' ;
14+ import { Job } from './jobs/job.entity' ;
915
1016@Module ( {
1117 imports : [
1218 ConfigModule . forRoot ( {
1319 isGlobal : true ,
1420 envFilePath : [ '.env.local' , '.env' ] ,
1521 } ) ,
22+ BullModule . forRootAsync ( {
23+ imports : [ ConfigModule ] ,
24+ useFactory : ( configService : ConfigService ) => ( {
25+ connection : {
26+ host : configService . get < string > ( 'REDIS_HOST' , 'localhost' ) ,
27+ port : configService . get < number > ( 'REDIS_PORT' , 6379 ) ,
28+ } ,
29+ } ) ,
30+ inject : [ ConfigService ] ,
31+ } ) ,
1632 TypeOrmModule . forRootAsync ( {
1733 imports : [ ConfigModule ] ,
1834 useFactory : ( configService : ConfigService ) => ( {
@@ -22,14 +38,16 @@ import { PreloadData } from './cache-warming/entities/preload-data.entity';
2238 username : configService . get < string > ( 'DB_USER' , 'postgres' ) ,
2339 password : configService . get < string > ( 'DB_PASSWORD' , 'password' ) ,
2440 database : configService . get < string > ( 'DB_NAME' , 'cache_warming_db' ) ,
25- entities : [ CacheJob , PreloadData , Metric ] ,
41+ entities : [ CacheJob , PreloadData , Metric , Event , DeadLetterEvent , Job ] ,
2642 synchronize : configService . get < string > ( 'NODE_ENV' ) !== 'production' ,
2743 logging : configService . get < string > ( 'NODE_ENV' ) === 'development' ,
2844 } ) ,
2945 inject : [ ConfigService ] ,
3046 } ) ,
3147 ScheduleModule . forRoot ( ) ,
3248 CacheWarmingModule ,
49+ EventsModule ,
50+ JobsModule ,
3351 ] ,
3452} )
35- export class AppModule { }
53+ export class AppModule { }
0 commit comments