Skip to content

Commit 3d0808b

Browse files
committed
fix:: 시작시간이 끝나는 시간보다 늦을 때 일정 생성, 수정 되지 않도록 수정
1 parent 422f8be commit 3d0808b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/schedule/schedule.service.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
BadRequestException,
23
ConflictException,
34
Inject,
45
Injectable,
@@ -50,6 +51,14 @@ export class ScheduleService {
5051
throw new NotFoundException('Timetable not found');
5152
}
5253

54+
if (
55+
createScheduleRequestDto.startTime >= createScheduleRequestDto.endTime
56+
) {
57+
throw new BadRequestException(
58+
'Start time must be earlier than end time',
59+
);
60+
}
61+
5362
// 시간표에 존재하는 강의, 스케쥴과 추가하려는 스케쥴이 시간이 겹치는 지 확인
5463
const isConflict = await this.checkTimeConflict(createScheduleRequestDto);
5564

@@ -102,6 +111,13 @@ export class ScheduleService {
102111
updateScheduleRequestDto.startTime &&
103112
updateScheduleRequestDto.endTime
104113
) {
114+
if (
115+
updateScheduleRequestDto.startTime >= updateScheduleRequestDto.endTime
116+
) {
117+
throw new BadRequestException(
118+
'Start time must be earlier than end time',
119+
);
120+
}
105121
// 시간표에 존재하는 강의, 스케쥴과 수정하려는 스케쥴이 시간이 겹치는 지 확인
106122
const isConflict = await this.checkTimeConflict(
107123
updateScheduleRequestDto,

0 commit comments

Comments
 (0)