Skip to content

Commit

Permalink
feat(ConversationResponse): modify response to include users' names &…
Browse files Browse the repository at this point in the history
… exclude users' login IDs/whether they are anonymous at front end's request
  • Loading branch information
becooq81 committed Aug 5, 2024
1 parent 1929c7f commit 8ce5bbb
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8ce5bbb

Please sign in to comment.