Merge branch 'refactor' into 'main'

refactor

See merge request v3/services/user!17
This commit is contained in:
Sylvain Briat 2023-02-01 14:00:53 +00:00
commit 907d495176
1 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
import { RabbitMQModule } from '@golevelup/nestjs-rabbitmq'; import { RabbitMQConfig, RabbitMQModule } from '@golevelup/nestjs-rabbitmq';
import { RedisModule, RedisModuleOptions } from '@liaoliaots/nestjs-redis'; import { RedisModule, RedisModuleOptions } from '@liaoliaots/nestjs-redis';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config'; import { ConfigModule, ConfigService } from '@nestjs/config';
@ -17,18 +17,19 @@ import { SetConfigurationUseCase } from './domain/usecases/set-configuration.use
inject: [ConfigService], inject: [ConfigService],
useFactory: async ( useFactory: async (
configService: ConfigService, configService: ConfigService,
): Promise<RedisModuleOptions> => { ): Promise<RedisModuleOptions> => ({
return {
config: { config: {
host: configService.get<string>('REDIS_HOST'), host: configService.get<string>('REDIS_HOST'),
port: configService.get<number>('REDIS_PORT'), port: configService.get<number>('REDIS_PORT'),
}, },
}; }),
},
}), }),
RabbitMQModule.forRootAsync(RabbitMQModule, { RabbitMQModule.forRootAsync(RabbitMQModule, {
imports: [ConfigModule], imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({ inject: [ConfigService],
useFactory: async (
configService: ConfigService,
): Promise<RabbitMQConfig> => ({
exchanges: [ exchanges: [
{ {
name: 'configuration', name: 'configuration',
@ -39,7 +40,6 @@ import { SetConfigurationUseCase } from './domain/usecases/set-configuration.use
connectionInitOptions: { wait: false }, connectionInitOptions: { wait: false },
enableControllerDiscovery: true, enableControllerDiscovery: true,
}), }),
inject: [ConfigService],
}), }),
], ],
controllers: [ConfigurationMessagerController], controllers: [ConfigurationMessagerController],