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 572213b commit 859a6d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public class CoffeeChat {
@Column(name = "coffee_chat_id")
private Long id;

private String message;
private String sendMessage;

private String rejectMessage;

@Enumerated(EnumType.STRING)
private State state;
Expand All @@ -39,8 +41,8 @@ public class CoffeeChat {
@JoinColumn(name = "from_user_id")
private User fromUser;

public CoffeeChat(String message, State state, User fromUser) {
this.message = message;
public CoffeeChat(String sendMessage, State state, User fromUser) {
this.sendMessage = sendMessage;
this.state = state;
this.fromUser = fromUser;
}
Expand All @@ -49,9 +51,9 @@ public void updateToUser(User toUser) {
this.toUser = toUser;
}

public void updateState(State state, String message) {
public void reject(State state, String rejectMessage) {
this.state = state;
this.message = message;
this.rejectMessage = rejectMessage;
}

public void updateState(State state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void reject(User user, Long coffeeChatId, String message) {
CoffeeChat coffeeChat = coffeeChatReader.read(coffeeChatId);
coffeeChatValidator.shouldBeSameUser(user, coffeeChat.getToUser());
coffeeChatValidator.shouldBePending(coffeeChat);
coffeeChatUpdater.updateState(coffeeChat, REJECT, message);
coffeeChatUpdater.reject(coffeeChat, REJECT, message);
mailService.sendMail(coffeeChat);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
@RequiredArgsConstructor
public class CoffeeChatUpdater {

public void updateState(CoffeeChat coffeeChat, State state, String message) {
coffeeChat.updateState(state, message);
public void reject(CoffeeChat coffeeChat, State state, String message) {
coffeeChat.reject(state, message);
}

public void updateState(CoffeeChat coffeeChat, State state) {
Expand Down

0 comments on commit 859a6d3

Please sign in to comment.