Skip to content

Commit

Permalink
chore(coffeechat): CoffeeChat 요청 생성 시간과 State 변경 시간 조회
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobhboy committed May 6, 2024
1 parent f76f203 commit 6b53659
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.sickgyun.server.coffeechat.domain;

import java.time.LocalDateTime;

import org.hibernate.annotations.CreationTimestamp;

import com.sickgyun.server.coffeechat.domain.value.State;
import com.sickgyun.server.user.domain.User;

Expand Down Expand Up @@ -41,10 +45,16 @@ public class CoffeeChat {
@JoinColumn(name = "from_user_id")
private User fromUser;

@CreationTimestamp
private LocalDateTime createdAt;

private LocalDateTime statedChangedTime;

public CoffeeChat(String sendMessage, State state, User fromUser) {
this.sendMessage = sendMessage;
this.state = state;
this.fromUser = fromUser;
this.createdAt = LocalDateTime.now();
}

public void updateToUser(User toUser) {
Expand All @@ -54,9 +64,11 @@ public void updateToUser(User toUser) {
public void reject(State state, String rejectMessage) {
this.state = state;
this.rejectMessage = rejectMessage;
statedChangedTime = LocalDateTime.now();
}

public void updateState(State state) {
this.state = state;
statedChangedTime = LocalDateTime.now();
}
}

0 comments on commit 6b53659

Please sign in to comment.