From ab870c81628dc858ca31a3a37b6e23db1c235f8a Mon Sep 17 00:00:00 2001 From: Lev Date: Wed, 25 Sep 2024 11:55:19 +0300 Subject: [PATCH] ChatController.sendMessage fix for review --- .../chat/yourway/controller/websocket/ChatController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chat/yourway/controller/websocket/ChatController.java b/src/main/java/com/chat/yourway/controller/websocket/ChatController.java index 875b112..d62d733 100644 --- a/src/main/java/com/chat/yourway/controller/websocket/ChatController.java +++ b/src/main/java/com/chat/yourway/controller/websocket/ChatController.java @@ -22,14 +22,16 @@ public class ChatController { private final MessageService messageService; @MessageMapping("/app/topic/public/{topicId}") - public void sendMessage(@DestinationVariable UUID topicId, MessageRequestDto message) { + public MessageResponseDto sendMessage(@DestinationVariable UUID topicId, MessageRequestDto message) { log.info("Received message for topic ID: {}", topicId); - messageService.sendToTopic(topicId, message); + MessageResponseDto sendMessage = messageService.sendToTopic(topicId, message); log.info("Message was saved in DB"); messagingTemplate.convertAndSend("/topic/public/" + topicId, message); log.info("Message sent to topic ID: {}", topicId) ; + + return sendMessage; } }