mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-12 04:32:41 +00:00
update packages, refactor
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user