Skip to content

Commit 6455cbe

Browse files
committed
refactor(party): 수동, 자동 파티완료 반영
1 parent 994b6b3 commit 6455cbe

File tree

1 file changed

+18
-3
lines changed
  • src/main/java/com/back/matchduo/domain/party/entity

1 file changed

+18
-3
lines changed

src/main/java/com/back/matchduo/domain/party/entity/Party.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ public class Party {
3131
@Column(name = "created_at", nullable = false)
3232
private LocalDateTime createdAt;
3333

34-
@Column(name = "closed_at", nullable = false)
34+
// 자동 파티완료 된 경우
35+
@Column(name = "expires_at", nullable = false)
36+
private LocalDateTime expiresAt;
37+
38+
// 수동 파티완료, 자동 파티완료 된 경우의 시간
39+
@Column(name = "closed_at")
3540
private LocalDateTime closedAt;
3641

3742

@@ -40,13 +45,23 @@ public Party(Long postId, Long leaderId) {
4045
this.leaderId = leaderId;
4146
this.status = PartyStatus.ACTIVE;
4247
this.createdAt = LocalDateTime.now();
43-
this.closedAt = this.createdAt.plusHours(6);
44-
}
48+
this.expiresAt = this.createdAt.plusHours(6);
49+
}
4550

4651

52+
// 파티장이 수동 파티완료 처리
4753
public void closeParty() {
4854
if (this.status == PartyStatus.ACTIVE) {
4955
this.status = PartyStatus.CLOSED;
56+
this.closedAt = LocalDateTime.now(); // 현재 시간 기록
57+
}
58+
}
59+
60+
// 스케줄러가 자동 파티완료 처리
61+
public void expireParty() {
62+
if (this.status == PartyStatus.ACTIVE) {
63+
this.status = PartyStatus.CLOSED;
64+
this.closedAt = this.expiresAt; // 만료 예정 시간이 곧 종료 시간
5065
}
5166
}
5267
}

0 commit comments

Comments
 (0)