Skip to content

Commit

Permalink
refactor(coffeechat) : 거절 시 거절 사유도 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
Woongbin06 committed Apr 26, 2024
1 parent 859a6d3 commit b4aa652
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public record AcceptResponse(
public static AcceptResponse from(CoffeeChat accept) {
return new AcceptResponse(
ContactResponse.from(accept.getFromUser().getContact()),
accept.getMessage()
accept.getSendMessage()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
public record MySentCoffeeChatResponse(
Long id,
State state,
String message,
String sendMessage,
String rejectMessage,
ContactResponse contact,
UserResponse toUser,
UserResponse fromUser
Expand All @@ -17,7 +18,8 @@ public static MySentCoffeeChatResponse from(CoffeeChat coffeeChat) {
return new MySentCoffeeChatResponse(
coffeeChat.getId(),
coffeeChat.getState(),
coffeeChat.getMessage(),
coffeeChat.getSendMessage(),
coffeeChat.getRejectMessage(),
coffeeChat.getState().equals(State.ACCEPT)
? ContactResponse.from(coffeeChat.getToUser().getContact()) : null,
UserResponse.from(coffeeChat.getToUser()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public record ReceivedCoffeeChatResponse(
State state,
UserResponse toUser,
UserResponse fromUser,
String message,
String sendMessage,
String rejectMessage,
ContactResponse contact
) {

Expand All @@ -19,7 +20,8 @@ public static ReceivedCoffeeChatResponse from(CoffeeChat coffeeChat) {
coffeeChat.getState(),
UserResponse.from(coffeeChat.getToUser()),
UserResponse.from(coffeeChat.getFromUser()),
coffeeChat.getMessage(),
coffeeChat.getSendMessage(),
coffeeChat.getRejectMessage(),
coffeeChat.getState() == State.ACCEPT ? ContactResponse.from(coffeeChat.getFromUser().getContact()) : null
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ private String setContext(CoffeeChat coffeeChat) {
Context context = new Context();
context.setVariable("fromuser", coffeeChat.getFromUser().getName());
context.setVariable("touser", coffeeChat.getToUser().getName());
context.setVariable("message", coffeeChat.getMessage());
context.setVariable("message",
coffeeChat.getState().equals(State.REJECT)
? coffeeChat.getRejectMessage() : coffeeChat.getSendMessage());
return checkState(coffeeChat.getState(), context);
}

Expand Down

0 comments on commit b4aa652

Please sign in to comment.