Skip to content

Commit 4f3e622

Browse files
committed
feat: 테스트용 시간 제한 풀기, 20분 보다 많이 남아야 가능하게, 시간제한 23시에서 21시로 수정
1 parent 65d50e2 commit 4f3e622

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/main/java/devut/buzzerbidder/domain/liveitem/service/LiveItemService.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,23 @@ public LiveItemCreateResponse writeLiveItem(LiveItemCreateRequest reqBody, User
7878

7979
LocalDateTime now = LocalDateTime.now();
8080

81-
// 1. 현재 시간과 liveTime 차이 확인
82-
if (reqBody.startAt().isBefore(now.plusHours(1))) {
83-
throw new BusinessException(ErrorCode.CLOSE_LIVETIME);
84-
}
85-
86-
LocalTime liveTimeOnly = reqBody.startAt().toLocalTime();
87-
// 2. 허용 시간 범위 체크 (09:00 ~ 23:00)
88-
if (liveTimeOnly.isBefore(LocalTime.of(9, 0)) || liveTimeOnly.isAfter(LocalTime.of(23, 0))) {
89-
throw new BusinessException(ErrorCode.INVALID_LIVETIME);
90-
}
91-
92-
// 3. 30분 단위 체크 + 초 체크
93-
int minute = liveTimeOnly.getMinute();
94-
int second = liveTimeOnly.getSecond();
95-
if ((minute != 0 && minute != 30)|| second !=0) {
96-
throw new BusinessException(ErrorCode.INVALID_LIVETIME);
97-
}
81+
// // 1. 현재 시간과 liveTime 차이 확인
82+
// if (reqBody.startAt().isBefore(now.plusMinutes(20))) {
83+
// throw new BusinessException(ErrorCode.CLOSE_LIVETIME);
84+
// }
85+
//
86+
// LocalTime liveTimeOnly = reqBody.startAt().toLocalTime();
87+
// // 2. 허용 시간 범위 체크 (09:00 ~ 21:00)
88+
// if (liveTimeOnly.isBefore(LocalTime.of(9, 0)) || liveTimeOnly.isAfter(LocalTime.of(21, 0))) {
89+
// throw new BusinessException(ErrorCode.INVALID_LIVETIME);
90+
// }
91+
//
92+
// // 3. 30분 단위 체크 + 초 체크
93+
// int minute = liveTimeOnly.getMinute();
94+
// int second = liveTimeOnly.getSecond();
95+
// if ((minute != 0 && minute != 30)|| second !=0) {
96+
// throw new BusinessException(ErrorCode.INVALID_LIVETIME);
97+
// }
9898

9999
// 4. 이미지 있는지 체크
100100
if (reqBody.images() == null || reqBody.images().isEmpty()) {
@@ -168,7 +168,7 @@ public LiveItemModifyResponse modifyLiveItem(Long id, LiveItemModifyRequest reqB
168168

169169
LocalDateTime now = LocalDateTime.now();
170170
// 1. 현재 시간과 liveTime 차이 확인
171-
if (liveItem.getLiveTime().isBefore(now.plusHours(1))) {
171+
if (liveItem.getLiveTime().isBefore(now.plusMinutes(20))) {
172172
throw new BusinessException(ErrorCode.EDIT_UNAVAILABLE);
173173
}
174174

@@ -229,14 +229,14 @@ public LiveItemModifyResponse modifyLiveItem(Long id, LiveItemModifyRequest reqB
229229
if (liveTimeChanged) {
230230

231231
// 1. 1시간 안에 시작하는지 확인
232-
if (reqBody.startAt().isBefore(now.plusHours(1))) {
232+
if (reqBody.startAt().isBefore(now.plusMinutes(20))) {
233233
throw new BusinessException(ErrorCode.INVALID_LIVETIME);
234234
}
235235

236236
LocalTime liveTimeOnly = reqBody.startAt().toLocalTime();
237-
// 2. 허용 시간 범위 체크 (09:00 ~ 23:00)
237+
// 2. 허용 시간 범위 체크 (09:00 ~ 21:00)
238238
if (liveTimeOnly.isBefore(LocalTime.of(9, 0)) || liveTimeOnly.isAfter(
239-
LocalTime.of(23, 0))) {
239+
LocalTime.of(21, 0))) {
240240
throw new BusinessException(ErrorCode.INVALID_LIVETIME);
241241
}
242242

@@ -316,7 +316,7 @@ public void deleteLiveItem(Long id, User user) {
316316

317317
LocalDateTime now = LocalDateTime.now();
318318
// 1. 현재 시간과 liveTime 차이 확인
319-
if (liveItem.getLiveTime().isBefore(now.plusHours(1))) {
319+
if (liveItem.getLiveTime().isBefore(now.plusMinutes(20))) {
320320
throw new BusinessException(ErrorCode.EDIT_UNAVAILABLE);
321321
}
322322

0 commit comments

Comments
 (0)