From 5babbfba334f87534c0e26237dc0e470bac69fdd Mon Sep 17 00:00:00 2001 From: Bae Hyeonseo Date: Thu, 23 May 2024 17:49:10 +0900 Subject: [PATCH] =?UTF-8?q?[fix]Socket=20image=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/RoomMessageElementResponseDto.java | 3 +++ .../socket/domain/chat/application/service/ChatService.java | 2 +- .../java/Backend/socket/domain/chat/domain/ChatContent.java | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/socket/src/main/java/Backend/socket/domain/chat/application/controller/dto/response/RoomMessageElementResponseDto.java b/socket/src/main/java/Backend/socket/domain/chat/application/controller/dto/response/RoomMessageElementResponseDto.java index 4f27d57..3c29027 100644 --- a/socket/src/main/java/Backend/socket/domain/chat/application/controller/dto/response/RoomMessageElementResponseDto.java +++ b/socket/src/main/java/Backend/socket/domain/chat/application/controller/dto/response/RoomMessageElementResponseDto.java @@ -15,6 +15,7 @@ public class RoomMessageElementResponseDto { private ChatUserResponseDto user; private String content; private String time; + private String image; public static List listOf(List chatContentList,String roomName,TriFunction formatter, TriFunction function,String ownerSession) { return chatContentList.stream() @@ -31,12 +32,14 @@ public static RoomMessageElementResponseDto of(ChatContent chatContent, String r .user(ChatUserResponseDto.of(chatUser,function.apply(ownerSession,chatUser.getSessionId()))) .content(chatContent.getContent()) .time(chatContent.getTime().toString()) + .image(chatContent.getImage()) .build(); } else { return RoomMessageElementResponseDto.builder() .user(ChatUserResponseDto.builder().build()) .content(chatContent.getContent()) .time(chatContent.getTime().toString()) + .image(chatContent.getImage()) .build(); } } diff --git a/socket/src/main/java/Backend/socket/domain/chat/application/service/ChatService.java b/socket/src/main/java/Backend/socket/domain/chat/application/service/ChatService.java index 4c74331..7f16eb1 100644 --- a/socket/src/main/java/Backend/socket/domain/chat/application/service/ChatService.java +++ b/socket/src/main/java/Backend/socket/domain/chat/application/service/ChatService.java @@ -63,7 +63,7 @@ public ChatMessageRoomResponseDto createSendMessageContentInRoom(String roomName Room room = getChatBySessionsInRoom(roomName, chatMessageRoomRequestDto.getChatSession()); User user = userRepository.findBySessionId(chatMessageRoomRequestDto.getChatSession()).orElseThrow(); // String images = awsService.uploadImageToS3(modifiedImageString); - ChatContent chatContent = createChatContent(chatMessageRoomRequestDto.getFromUserName(), chatMessageRoomRequestDto.getContent(), room); + ChatContent chatContent = createChatContent(chatMessageRoomRequestDto.getFromUserName(), chatMessageRoomRequestDto.getContent(), room, chatMessageRoomRequestDto.getImage()); ChatMessageElementResponseDto chatMessage = ChatMessageElementResponseDto.of(chatContent, chatMessageRoomRequestDto.getChatSession(), user.getProfile(), chatMessageRoomRequestDto.getImage(), validate(room.getOwnerSession(),chatMessageRoomRequestDto.getChatSession())); List sessionIdList = getSessionIdListInRoom(roomName, chatMessageRoomRequestDto.getChatSession()); diff --git a/socket/src/main/java/Backend/socket/domain/chat/domain/ChatContent.java b/socket/src/main/java/Backend/socket/domain/chat/domain/ChatContent.java index 6fd1816..dc0f11c 100644 --- a/socket/src/main/java/Backend/socket/domain/chat/domain/ChatContent.java +++ b/socket/src/main/java/Backend/socket/domain/chat/domain/ChatContent.java @@ -10,9 +10,10 @@ public class ChatContent { private String userName; private String content; + private String image; private LocalDateTime time; - public static ChatContent createChatContent(String userName, String content, Chat chat) { + public static ChatContent createChatContent(String userName, String content,Chat chat) { ChatContent chatContent = ChatContent.builder() .userName(userName) .content(content) @@ -21,7 +22,7 @@ public static ChatContent createChatContent(String userName, String content, Cha chat.addChatContent(chatContent); return chatContent; } - public static ChatContent createChatContent(String userName, String content, Room room) { + public static ChatContent createChatContent(String userName, String content, Room room,String image) { ChatContent chatContent = ChatContent.builder() .userName(userName) .content(content)