2023-04-06 09:12:49 +00:00
|
|
|
import { Module } from '@nestjs/common';
|
2023-10-31 13:29:05 +00:00
|
|
|
import { ConfigModule } from '@nestjs/config';
|
2023-05-02 15:26:04 +00:00
|
|
|
import { AdModule } from './modules/ad/ad.module';
|
2023-08-16 10:28:20 +00:00
|
|
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
|
|
|
import { RequestContextModule } from 'nestjs-request-context';
|
|
|
|
import { MessagerModule } from '@modules/messager/messager.module';
|
|
|
|
import { HealthModule, HealthRepositoryPort } from '@mobicoop/health-module';
|
|
|
|
import { AD_REPOSITORY } from '@modules/ad/ad.di-tokens';
|
|
|
|
import { MESSAGE_PUBLISHER } from '@modules/messager/messager.di-tokens';
|
|
|
|
import { HealthModuleOptions } from '@mobicoop/health-module/dist/core/domain/types/health.types';
|
|
|
|
import { MessagePublisherPort } from '@mobicoop/ddd-library';
|
2023-08-18 10:47:51 +00:00
|
|
|
import { GeographyModule } from '@modules/geography/geography.module';
|
2024-03-13 16:54:34 +00:00
|
|
|
import producerServicesConfig from './config/producer-services.config';
|
2023-10-18 08:21:43 +00:00
|
|
|
import {
|
|
|
|
HEALTH_AD_REPOSITORY,
|
|
|
|
HEALTH_CRITICAL_LOGGING_KEY,
|
|
|
|
SERVICE_NAME,
|
|
|
|
} from './app.constants';
|
2023-04-06 09:12:49 +00:00
|
|
|
|
|
|
|
@Module({
|
|
|
|
imports: [
|
2024-03-13 16:54:34 +00:00
|
|
|
ConfigModule.forRoot({ isGlobal: true, load: [producerServicesConfig] }),
|
2023-08-16 10:28:20 +00:00
|
|
|
EventEmitterModule.forRoot(),
|
|
|
|
RequestContextModule,
|
|
|
|
HealthModule.forRootAsync({
|
|
|
|
imports: [AdModule, MessagerModule],
|
|
|
|
inject: [AD_REPOSITORY, MESSAGE_PUBLISHER],
|
|
|
|
useFactory: async (
|
|
|
|
adRepository: HealthRepositoryPort,
|
|
|
|
messagePublisher: MessagePublisherPort,
|
|
|
|
): Promise<HealthModuleOptions> => ({
|
2023-10-18 08:21:43 +00:00
|
|
|
serviceName: SERVICE_NAME,
|
|
|
|
criticalLoggingKey: HEALTH_CRITICAL_LOGGING_KEY,
|
2023-08-16 10:28:20 +00:00
|
|
|
checkRepositories: [
|
|
|
|
{
|
2023-10-18 08:21:43 +00:00
|
|
|
name: HEALTH_AD_REPOSITORY,
|
2023-08-16 10:28:20 +00:00
|
|
|
repository: adRepository,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
messagePublisher,
|
|
|
|
}),
|
2023-05-30 09:41:30 +00:00
|
|
|
}),
|
2023-04-24 14:44:52 +00:00
|
|
|
AdModule,
|
2023-08-18 10:47:51 +00:00
|
|
|
GeographyModule,
|
2023-08-16 10:28:20 +00:00
|
|
|
MessagerModule,
|
2023-04-06 09:12:49 +00:00
|
|
|
],
|
2023-08-18 14:50:55 +00:00
|
|
|
exports: [AdModule, GeographyModule, MessagerModule],
|
2023-04-06 09:12:49 +00:00
|
|
|
})
|
|
|
|
export class AppModule {}
|