From c8ea87658e9e0e4474ec605b2d3be38261147342 Mon Sep 17 00:00:00 2001 From: sungjiwoon Date: Mon, 22 Jan 2024 21:48:18 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20sender=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/catchroom/chat/feign/client/MainFeignClient.java | 2 +- .../com/catchroom/chat/global/common/SuccessMessage.java | 9 +++++++++ .../com/catchroom/chat/message/dto/ChatMessageDto.java | 2 -- .../com/catchroom/chat/message/entity/ChatMessage.java | 2 -- .../chat/message/repository/ChatRoomRepository.java | 3 ++- .../com/catchroom/chat/message/type/MessageType.java | 2 +- .../com/catchroom/chat/test/MessageSortController.java | 1 - 7 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/catchroom/chat/global/common/SuccessMessage.java diff --git a/src/main/java/com/catchroom/chat/feign/client/MainFeignClient.java b/src/main/java/com/catchroom/chat/feign/client/MainFeignClient.java index 0479feb..50afa74 100644 --- a/src/main/java/com/catchroom/chat/feign/client/MainFeignClient.java +++ b/src/main/java/com/catchroom/chat/feign/client/MainFeignClient.java @@ -24,7 +24,7 @@ configuration = FeignConfig.class ) public interface MainFeignClient { -// user의 닉네임 + @RequestMapping(method = RequestMethod.GET, value = "/accommodation/{accommodationId}") AccommodationResponse getAccommodationDto(@PathVariable Long accommodationId); diff --git a/src/main/java/com/catchroom/chat/global/common/SuccessMessage.java b/src/main/java/com/catchroom/chat/global/common/SuccessMessage.java new file mode 100644 index 0000000..cc7a52c --- /dev/null +++ b/src/main/java/com/catchroom/chat/global/common/SuccessMessage.java @@ -0,0 +1,9 @@ +package com.catchroom.chat.global.common; + +public record SuccessMessage( + String Meassage +) { + public static SuccessMessage createSuccessMessage(String message) { + return new SuccessMessage(message); + } +} diff --git a/src/main/java/com/catchroom/chat/message/dto/ChatMessageDto.java b/src/main/java/com/catchroom/chat/message/dto/ChatMessageDto.java index 16e943e..9de7f25 100644 --- a/src/main/java/com/catchroom/chat/message/dto/ChatMessageDto.java +++ b/src/main/java/com/catchroom/chat/message/dto/ChatMessageDto.java @@ -20,7 +20,6 @@ public class ChatMessageDto implements Serializable { private MessageType type; // 메시지 타입 private String roomId; // 방 번호 - private String sender; // 채팅을 보낸 사람 private Long userId; private String message; // 메시지 private String time; @@ -30,7 +29,6 @@ public class ChatMessageDto implements Serializable { public static ChatMessageDto fromEntity(ChatMessage chatMessage) { return ChatMessageDto.builder() .type(chatMessage.getType()) - .sender(chatMessage.getSender()) .userId(chatMessage.getUserId()) .roomId(chatMessage.getRoomId()) .time(chatMessage.getTime()) diff --git a/src/main/java/com/catchroom/chat/message/entity/ChatMessage.java b/src/main/java/com/catchroom/chat/message/entity/ChatMessage.java index ac6129e..63f4667 100644 --- a/src/main/java/com/catchroom/chat/message/entity/ChatMessage.java +++ b/src/main/java/com/catchroom/chat/message/entity/ChatMessage.java @@ -16,7 +16,6 @@ public class ChatMessage { private MessageType type; // 메시지 타입 private String roomId; // 방 번호 - private String sender; // 채팅을 보낸 사람 private Long userId; // 채팅 보낸 userId private String message; // 메시지 private String time; // 메시지 보낸 시간 @@ -26,7 +25,6 @@ public static ChatMessage of(ChatMessageDto dto) { return ChatMessage.builder() .type(dto.getType()) .roomId(dto.getRoomId()) - .sender(dto.getSender()) .userId(dto.getUserId()) .message(dto.getMessage()) .time(LocalDateTime.now().toString()) diff --git a/src/main/java/com/catchroom/chat/message/repository/ChatRoomRepository.java b/src/main/java/com/catchroom/chat/message/repository/ChatRoomRepository.java index e7c0a16..f5bd505 100644 --- a/src/main/java/com/catchroom/chat/message/repository/ChatRoomRepository.java +++ b/src/main/java/com/catchroom/chat/message/repository/ChatRoomRepository.java @@ -18,7 +18,8 @@ public class ChatRoomRepository { private static final String CHAT_ROOM = "CHAT_ROOM_LAST_MSG"; //채팅방 public static final String USER_COUNT = "USER_COUNT"; // 채팅룸에 입장한 클라이언트수 저장 - public static final String ENTER_INFO = "ENTER_INFO"; // 채팅룸에 입장한 클라이언트의 sessionId와 채팅룸 id를 맵핑한 정보 저장 + public static final String ENTER_INFO = "ENTER_INFO"; + // 채팅룸에 입장한 클라이언트의 sessionId와 채팅룸 id를 맵핑한 정보 저장 // HashOperations : Redis의 해시 데이터 구조를 다룸. // String 타입의 key, String 타입의 필드, chatRoom 객체의 값으로 구성된 해시를 다룬다. diff --git a/src/main/java/com/catchroom/chat/message/type/MessageType.java b/src/main/java/com/catchroom/chat/message/type/MessageType.java index 6aae3ea..7c0503a 100644 --- a/src/main/java/com/catchroom/chat/message/type/MessageType.java +++ b/src/main/java/com/catchroom/chat/message/type/MessageType.java @@ -6,5 +6,5 @@ @AllArgsConstructor @Getter public enum MessageType { - ENTER, TALK, QUIT, NEGO_REQ, NEGO_ALLOW, NEGO_DENIED + ENTER, TALK, QUIT, NEGO_REQ, NEGO_ALLOW, NEGO_DENIED, DELETE } diff --git a/src/main/java/com/catchroom/chat/test/MessageSortController.java b/src/main/java/com/catchroom/chat/test/MessageSortController.java index f9016ed..5c32939 100644 --- a/src/main/java/com/catchroom/chat/test/MessageSortController.java +++ b/src/main/java/com/catchroom/chat/test/MessageSortController.java @@ -28,7 +28,6 @@ public MessageSubDto getChatRoomListAndMessage( ChatMessageDto chatMessageDto = new ChatMessageDto(); chatMessageDto.setType(MessageType.ENTER); chatMessageDto.setRoomId("test-room-id-kkkk"); - chatMessageDto.setSender("혜민"); chatMessageDto.setUserId(4L); chatMessageDto.setMessage("test 메세지 보냄"); chatMessageDto.setTime(String.valueOf(LocalDateTime.now()));