From 8ce5bbbc19ffc36437b0a1047d654d624691cba4 Mon Sep 17 00:00:00 2001 From: becooq81 Date: Mon, 5 Aug 2024 23:56:33 +0900 Subject: [PATCH] feat(ConversationResponse): modify response to include users' names & exclude users' login IDs/whether they are anonymous at front end's request --- .../api/conversation/dto/ConversationResponse.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/poolc/api/conversation/dto/ConversationResponse.java b/src/main/java/org/poolc/api/conversation/dto/ConversationResponse.java index 49905a9b..a180acab 100644 --- a/src/main/java/org/poolc/api/conversation/dto/ConversationResponse.java +++ b/src/main/java/org/poolc/api/conversation/dto/ConversationResponse.java @@ -11,20 +11,16 @@ public class ConversationResponse { private String id; - private String starterLoginID; - private String otherLoginID; - private boolean starterAnonymous; - private boolean otherAnonymous; + private String starterName; + private String otherName; private MessageResponse lastMessage; protected ConversationResponse() {} - public static ConversationResponse of(Conversation conversation) { + public static ConversationResponse of(Conversation conversation, String starterName, String otherName) { ConversationResponse response = new ConversationResponse(); response.setId(conversation.getId()); - response.setStarterLoginID(conversation.getStarterLoginID()); - response.setOtherLoginID(conversation.getOtherLoginID()); - response.setStarterAnonymous(conversation.isStarterAnonymous()); - response.setOtherAnonymous(conversation.isOtherAnonymous()); + response.setStarterName(starterName); + response.setOtherName(otherName); if (conversation.getLastMessage() != null) response.setLastMessage(MessageResponse.of(conversation.getLastMessage())); return response; }