From 7907393a09e4f5ed6fa8856171963d7d08b94063 Mon Sep 17 00:00:00 2001 From: OJOJIN Date: Tue, 23 Jan 2024 01:58:57 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[feat]=20#57=20=EC=9D=B4=EC=A0=84=20?= =?UTF-8?q?=EC=B1=84=ED=8C=85=20=EC=A1=B0=ED=9A=8C=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=EA=B0=92=20requestUserId=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/chat/dto/response/ChatListResponseDto.java | 5 ++++- .../gachon/checkmate/domain/chat/service/ChatService.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gachon/checkmate/domain/chat/dto/response/ChatListResponseDto.java b/src/main/java/org/gachon/checkmate/domain/chat/dto/response/ChatListResponseDto.java index 2835388..5999a0c 100644 --- a/src/main/java/org/gachon/checkmate/domain/chat/dto/response/ChatListResponseDto.java +++ b/src/main/java/org/gachon/checkmate/domain/chat/dto/response/ChatListResponseDto.java @@ -15,6 +15,8 @@ public class ChatListResponseDto{ private String chatRoomId; + private Long requestUserId; + private ChatUserInfoDto chatUserInfoDto; @Builder.Default @@ -26,9 +28,10 @@ public class ChatListResponseDto{ @Builder.Default private Integer pageNumber = null; - public static ChatListResponseDto of(String chatRoomId, ChatUserInfoDto chatUserInfoDto) { + public static ChatListResponseDto of(String chatRoomId, Long requestUserId, ChatUserInfoDto chatUserInfoDto) { return ChatListResponseDto.builder() .chatRoomId(chatRoomId) + .requestUserId(requestUserId) .chatUserInfoDto(chatUserInfoDto) .build(); } diff --git a/src/main/java/org/gachon/checkmate/domain/chat/service/ChatService.java b/src/main/java/org/gachon/checkmate/domain/chat/service/ChatService.java index 312cd98..32d3589 100644 --- a/src/main/java/org/gachon/checkmate/domain/chat/service/ChatService.java +++ b/src/main/java/org/gachon/checkmate/domain/chat/service/ChatService.java @@ -98,7 +98,7 @@ public ChatListResponseDto getChatList(Map simpSessionAttributes String chatRoomId = getChatRoomId(request.otherUserId(), userId); ChatUserInfoDto chatUserInfoDto = getUserChatUserInfoByUserId(request); - ChatListResponseDto response = ChatListResponseDto.of(chatRoomId, chatUserInfoDto); + ChatListResponseDto response = ChatListResponseDto.of(chatRoomId, userId, chatUserInfoDto); PageRequest pageRequest = PageRequest.of(request.pageNumber(), request.pageSize()); Slice chatMessages = chatRepository.findBeforeChatList(chatRoomId, pageRequest); From d56c3b43baa9c4db84b70a25c34595475bcb4911 Mon Sep 17 00:00:00 2001 From: OJOJIN Date: Tue, 23 Jan 2024 01:59:44 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[fix]=20#57=20=EC=9D=B4=EC=A0=84=20?= =?UTF-8?q?=EC=B1=84=ED=8C=85=20=EC=A1=B0=ED=9A=8C=20destination=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkmate/domain/chat/controller/ChatController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gachon/checkmate/domain/chat/controller/ChatController.java b/src/main/java/org/gachon/checkmate/domain/chat/controller/ChatController.java index 984fd16..fad2bbf 100644 --- a/src/main/java/org/gachon/checkmate/domain/chat/controller/ChatController.java +++ b/src/main/java/org/gachon/checkmate/domain/chat/controller/ChatController.java @@ -27,22 +27,22 @@ public class ChatController { public void sendChat(@Header("simpSessionAttributes") Map simpSessionAttributes, @Payload final ChatRequestDto request) { ChatResponseDto response = chatService.sendChat(simpSessionAttributes, request); - sendingOperations.convertAndSend("/queue/chat/"+simpSessionAttributes.get("roomId"), SocketBaseResponse.of(MessageType.CHAT, response)); + sendingOperations.convertAndSend("/queue/chat/" + simpSessionAttributes.get("roomId"), SocketBaseResponse.of(MessageType.CHAT, response)); } // 채팅방 정보 조회 @MessageMapping("/room-list") public void getChatRoomList(@Header("simpSessionAttributes") Map simpSessionAttributes) { ChatRoomListResponseDto response = chatService.getChatRoomList(simpSessionAttributes); - sendingOperations.convertAndSend("/queue/user/"+simpSessionAttributes.get("userId"), SocketBaseResponse.of(MessageType.ROOM_LIST, response)); + sendingOperations.convertAndSend("/queue/user/" + simpSessionAttributes.get("userId"), SocketBaseResponse.of(MessageType.ROOM_LIST, response)); } // 이전 채팅 불러오기 @MessageMapping("/chat-list") public void getChatList(@Header("simpSessionAttributes") Map simpSessionAttributes, @Payload final ChatListRequestDto request) { - final ChatListResponseDto response = chatService.getChatList(simpSessionAttributes, request); - sendingOperations.convertAndSend("/queue/user/" + simpSessionAttributes.get("userId"), SocketBaseResponse.of(MessageType.CHAT_LIST, response)); + ChatListResponseDto response = chatService.getChatList(simpSessionAttributes, request); + sendingOperations.convertAndSend("/queue/chat/" + response.getChatRoomId(), SocketBaseResponse.of(MessageType.CHAT_LIST, response)); } // 채팅방 입장하기