diff --git a/backend/src/modules/chat/application/chat.service.ts b/backend/src/modules/chat/application/chat.service.ts index 2ce0e2d..c184907 100644 --- a/backend/src/modules/chat/application/chat.service.ts +++ b/backend/src/modules/chat/application/chat.service.ts @@ -193,6 +193,8 @@ export class ChatService { savedMessage.type || 'TEXT', new Date(), + + chat.ticketId, // Adicionado aqui ), ); diff --git a/backend/src/modules/notification/application/dto/create-notification.dto.ts b/backend/src/modules/notification/application/dto/create-notification.dto.ts index 5f6071e..a72f125 100644 --- a/backend/src/modules/notification/application/dto/create-notification.dto.ts +++ b/backend/src/modules/notification/application/dto/create-notification.dto.ts @@ -19,6 +19,8 @@ export interface CreateMessageNotificationDTO { chatId: string; + ticketId?: string; + messageId: string; contentPreview: string; diff --git a/backend/src/modules/notification/application/listeners/received-message.listener.ts b/backend/src/modules/notification/application/listeners/received-message.listener.ts index d462453..9e7f76e 100644 --- a/backend/src/modules/notification/application/listeners/received-message.listener.ts +++ b/backend/src/modules/notification/application/listeners/received-message.listener.ts @@ -51,6 +51,9 @@ export class ReceivedMessageListener { chatId: event.chatId, + ticketId: + event.ticketId, + messageId: event.messageId, @@ -75,6 +78,9 @@ export class ReceivedMessageListener { chatId: event.chatId, + ticketId: // Adicionado aqui para o frontend SSE + event.ticketId, + messageId: event.messageId, diff --git a/backend/src/modules/notification/application/use-cases/create-message-notification.use-case.ts b/backend/src/modules/notification/application/use-cases/create-message-notification.use-case.ts index ec69dda..8c34bd0 100644 --- a/backend/src/modules/notification/application/use-cases/create-message-notification.use-case.ts +++ b/backend/src/modules/notification/application/use-cases/create-message-notification.use-case.ts @@ -39,6 +39,7 @@ export class CreateMessageNotificationUseCase { type: NotificationType.NEW_MESSAGE, chatId: data.chatId, + ticketId: data.ticketId, }); await this.notificationRepository.create( diff --git a/backend/src/shared/events/received-message-notification.event.ts b/backend/src/shared/events/received-message-notification.event.ts index 245dc5b..6a95ed1 100644 --- a/backend/src/shared/events/received-message-notification.event.ts +++ b/backend/src/shared/events/received-message-notification.event.ts @@ -17,5 +17,7 @@ export class ReceivedMessageNotificationEvent { public readonly type: string, public readonly createdAt: Date, + + public readonly ticketId?: string, ) {} } \ No newline at end of file