From 2efe4d8bcd69f6434e10ad28f8c4413b247623ec Mon Sep 17 00:00:00 2001 From: khw18 Date: Sun, 7 Jul 2024 22:35:43 +0900 Subject: [PATCH] Feat: get chat list #102 --- .../com/hana/hanalink/chat/controller/ChatController.java | 2 +- .../hana/hanalink/chat/controller/ChatRestController.java | 5 ++--- .../com/hana/hanalink/chat/repository/ChatRepository.java | 1 - .../java/com/hana/hanalink/chat/service/ChatService.java | 1 - 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hana/hanalink/chat/controller/ChatController.java b/src/main/java/com/hana/hanalink/chat/controller/ChatController.java index 0f69f5d..ff7a734 100644 --- a/src/main/java/com/hana/hanalink/chat/controller/ChatController.java +++ b/src/main/java/com/hana/hanalink/chat/controller/ChatController.java @@ -21,7 +21,7 @@ public class ChatController { */ @MessageMapping("/send") public Mono message(@Payload ChatDto chatDto) { - simpMessageSendingOperations.convertAndSend("topic" + chatDto.getRoomId(), chatDto); + simpMessageSendingOperations.convertAndSend("/topic/" + chatDto.getRoomId(), chatDto); return chatService.saveChat(chatDto.toEntity()).then(); } diff --git a/src/main/java/com/hana/hanalink/chat/controller/ChatRestController.java b/src/main/java/com/hana/hanalink/chat/controller/ChatRestController.java index d0f8d7c..5ae04ec 100644 --- a/src/main/java/com/hana/hanalink/chat/controller/ChatRestController.java +++ b/src/main/java/com/hana/hanalink/chat/controller/ChatRestController.java @@ -9,9 +9,8 @@ import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; - @RestController -@RequestMapping("/chat") +@RequestMapping("/api/v1/chat") @RequiredArgsConstructor public class ChatRestController { private final ChatService chatService; @@ -20,4 +19,4 @@ public class ChatRestController { public Flux getChatsByRoomId(@PathVariable String roomId) { return chatService.getChatsByRoomId(roomId); } -} \ No newline at end of file +} diff --git a/src/main/java/com/hana/hanalink/chat/repository/ChatRepository.java b/src/main/java/com/hana/hanalink/chat/repository/ChatRepository.java index a8e4826..12127d1 100644 --- a/src/main/java/com/hana/hanalink/chat/repository/ChatRepository.java +++ b/src/main/java/com/hana/hanalink/chat/repository/ChatRepository.java @@ -9,5 +9,4 @@ @Repository public interface ChatRepository extends ReactiveMongoRepository { Flux findByRoomId(String roomId); - } diff --git a/src/main/java/com/hana/hanalink/chat/service/ChatService.java b/src/main/java/com/hana/hanalink/chat/service/ChatService.java index b75c4ef..8970b75 100644 --- a/src/main/java/com/hana/hanalink/chat/service/ChatService.java +++ b/src/main/java/com/hana/hanalink/chat/service/ChatService.java @@ -24,5 +24,4 @@ public Mono saveChat(Chat chat) { public Flux getChatsByRoomId(String roomId) { return chatRepository.findByRoomId(roomId); } - }