From 02bf7b0fd9606b25f0bf9a65aa316bdc322881cf Mon Sep 17 00:00:00 2001 From: Woongbin06 Date: Sat, 27 Apr 2024 01:22:16 +0900 Subject: [PATCH] =?UTF-8?q?refactor(coffeechat)=20:=20=EC=BB=A4=ED=94=BC?= =?UTF-8?q?=EC=B1=97=EC=9D=B4=20=EC=88=98=EB=9D=BD=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EC=9D=BC=20=EB=95=8C=20=EC=83=81=EB=8C=80=EB=B0=A9=EC=9D=98=20?= =?UTF-8?q?=EC=97=B0=EB=9D=BD=EC=B2=98=EB=8F=84=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coffeechat/presentation/CoffeeChatController.java | 6 +++--- ...ChatResponse.java => MySentCoffeeChatResponse.java} | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) rename main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/{CoffeeChatResponse.java => MySentCoffeeChatResponse.java} (58%) diff --git a/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/CoffeeChatController.java b/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/CoffeeChatController.java index 9ffdcf2..66e1534 100644 --- a/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/CoffeeChatController.java +++ b/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/CoffeeChatController.java @@ -18,7 +18,7 @@ import com.sickgyun.server.auth.repository.AuthRepository; import com.sickgyun.server.coffeechat.presentation.dto.AcceptResponse; import com.sickgyun.server.coffeechat.presentation.dto.CoffeeChatRequest; -import com.sickgyun.server.coffeechat.presentation.dto.CoffeeChatResponse; +import com.sickgyun.server.coffeechat.presentation.dto.MySentCoffeeChatResponse; import com.sickgyun.server.coffeechat.presentation.dto.ReceivedCoffeeChatResponse; import com.sickgyun.server.coffeechat.service.CommandCoffeeChatService; import com.sickgyun.server.coffeechat.service.QueryCoffeeChatService; @@ -75,9 +75,9 @@ public List getReceiveCoffeeChat() { @GetMapping("/my/send") @LoginRequired - public List getSendPendingChat() { + public List getSendPendingChat() { return queryCoffeeChatService.getByFromUser(authRepository.getCurrentUser()).stream() - .map(CoffeeChatResponse::from) + .map(MySentCoffeeChatResponse::from) .toList(); } diff --git a/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/CoffeeChatResponse.java b/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/MySentCoffeeChatResponse.java similarity index 58% rename from main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/CoffeeChatResponse.java rename to main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/MySentCoffeeChatResponse.java index 6556938..9d1d599 100644 --- a/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/CoffeeChatResponse.java +++ b/main-server/src/main/java/com/sickgyun/server/coffeechat/presentation/dto/MySentCoffeeChatResponse.java @@ -4,17 +4,21 @@ import com.sickgyun.server.coffeechat.domain.value.State; import com.sickgyun.server.user.presentation.dto.UserResponse; -public record CoffeeChatResponse( +public record MySentCoffeeChatResponse( Long id, State state, + String message, + ContactResponse contact, UserResponse toUser, UserResponse fromUser ) { - public static CoffeeChatResponse from(CoffeeChat coffeeChat) { - return new CoffeeChatResponse( + public static MySentCoffeeChatResponse from(CoffeeChat coffeeChat) { + return new MySentCoffeeChatResponse( coffeeChat.getId(), coffeeChat.getState(), + coffeeChat.getMessage(), + coffeeChat.getState().equals(State.ACCEPT) ? ContactResponse.from(coffeeChat.getToUser().getContact()) : null, UserResponse.from(coffeeChat.getToUser()), UserResponse.from(coffeeChat.getFromUser()) );