update packages, refactor

This commit is contained in:
sbriat
2023-10-17 14:48:05 +02:00
parent 54c0718a5d
commit 79f42ae192
38 changed files with 3616 additions and 1977 deletions

View File

@@ -6,6 +6,15 @@ import {
MessageBrokerPublisher,
} from '@mobicoop/message-broker-module';
import { ConfigModule, ConfigService } from '@nestjs/config';
import {
SERVICE_NAME,
USER_DELETED_MESSAGE_HANDLER,
USER_DELETED_QUEUE,
USER_DELETED_ROUTING_KEY,
USER_UPDATED_MESSAGE_HANDLER,
USER_UPDATED_QUEUE,
USER_UPDATED_ROUTING_KEY,
} from '@src/app.constants';
const imports = [
MessageBrokerModule.forRootAsync({
@@ -14,17 +23,22 @@ const imports = [
useFactory: async (
configService: ConfigService,
): Promise<MessageBrokerModuleOptions> => ({
uri: configService.get<string>('MESSAGE_BROKER_URI'),
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
name: 'auth',
uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
exchange: {
name: configService.get<string>('MESSAGE_BROKER_EXCHANGE') as string,
durable: configService.get<boolean>(
'MESSAGE_BROKER_EXCHANGE_DURABILITY',
) as boolean,
},
name: SERVICE_NAME,
handlers: {
userUpdated: {
routingKey: 'user.updated',
queue: 'auth-user-updated',
[USER_UPDATED_MESSAGE_HANDLER]: {
routingKey: USER_UPDATED_ROUTING_KEY,
queue: USER_UPDATED_QUEUE,
},
userDeleted: {
routingKey: 'user.deleted',
queue: 'auth-user-deleted',
[USER_DELETED_MESSAGE_HANDLER]: {
routingKey: USER_DELETED_ROUTING_KEY,
queue: USER_DELETED_QUEUE,
},
},
}),