From f3bbcc6800ae0f69a3f8890948b51c86435ee1af Mon Sep 17 00:00:00 2001 From: Michal Ostrowski Date: Mon, 25 Mar 2024 09:26:37 +0100 Subject: [PATCH] fix: proper place for the debug option --- src/message-dispatcher.decorator.ts | 1 + src/message-dispatcher.interceptor.ts | 2 +- src/options.dto.ts | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/message-dispatcher.decorator.ts b/src/message-dispatcher.decorator.ts index 5f99846..99ff839 100644 --- a/src/message-dispatcher.decorator.ts +++ b/src/message-dispatcher.decorator.ts @@ -12,6 +12,7 @@ export const DispatcherParamsMetadata = 'dispatcher-options'; export interface DispatcherOptions { action: ((req: any, data: any) => Action) | string; objectIdGetter: (req: any, data: any) => string | string[]; + debug?: boolean; } export const MessageEventEmitter = (params: DispatcherOptions) => diff --git a/src/message-dispatcher.interceptor.ts b/src/message-dispatcher.interceptor.ts index 6aac12e..9cb9aaa 100644 --- a/src/message-dispatcher.interceptor.ts +++ b/src/message-dispatcher.interceptor.ts @@ -60,7 +60,7 @@ export class MessageDispatcherInterceptor implements NestInterceptor { timestamp: timestamp(), }; - if (this.options.debug) { + if (options.debug) { this.logger.debug(this.options.subject, JSON.stringify(sendData)); } diff --git a/src/options.dto.ts b/src/options.dto.ts index c20acc0..6b0a0a5 100644 --- a/src/options.dto.ts +++ b/src/options.dto.ts @@ -3,5 +3,4 @@ import { Message } from './message.dto'; export class Options { subject: string; messageData: Message; - debug?: boolean; }