Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 일정 생성 예외처리 #87

Merged
merged 1 commit into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/kdt/web_ide/common/exception/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public enum ErrorCode {
SCHEDULE_ACCESS_ERROR(HttpStatus.UNAUTHORIZED, "SCHEDULE-002", "권한이 없습니다."),
MEMBER_NOT_FOUND(HttpStatus.NOT_FOUND, "SCHEDULE-003", "일정에 참여하지 않는 멤버입니다."),
MEMBER_ALREADY_IN_SCHEDULE(HttpStatus.BAD_REQUEST, "SCHEDULE-004", "일정에 이미 참여하는 멤버입니다."),
INVALID_SCHEDULE_FORMAT(HttpStatus.BAD_REQUEST, "SCHEDULE-005", "일정은 5분 단위로 등록해야 합니다.");
INVALID_SCHEDULE_FORMAT(HttpStatus.BAD_REQUEST, "SCHEDULE-005", "일정은 5분 단위로 등록해야 합니다."),
DATETIME_ERROR(HttpStatus.BAD_REQUEST, "SCHEDULE-006", "시작 시간은 종료 시간보다 이전이어야 합니다.");

private final HttpStatus httpStatus; // HttpStatus
private final String code; // ACCOUNT-001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public ScheduleResponseDto saveSchedule(
.findById(boardId)
.orElseThrow(() -> new CustomException(ErrorCode.BOARD_NOT_FOUND));

if ((requestDto.getStartAt()).isAfter(requestDto.getEndAt()))
throw new CustomException(ErrorCode.DATETIME_ERROR);
// 5분 단위로 떨어지는지 확인
if (requestDto.getStartAt() != null && requestDto.getStartAt().getMinute() % 5 != 0) {
throw new CustomException(ErrorCode.INVALID_SCHEDULE_FORMAT);
Expand Down
Loading