From 2d4b67ad9880d42554245ec1709482cd031cc0a8 Mon Sep 17 00:00:00 2001 From: pricelees Date: Thu, 24 Jul 2025 09:56:59 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20reservation=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=EC=9D=98=20=EC=BB=A4=EC=8A=A4=ED=85=80=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/ReservationErrorCode.kt | 20 +++++++++++++++++++ .../exception/ReservationException.kt | 9 +++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt create mode 100644 src/main/kotlin/roomescape/reservation/exception/ReservationException.kt diff --git a/src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt b/src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt new file mode 100644 index 00000000..fc61f9a3 --- /dev/null +++ b/src/main/kotlin/roomescape/reservation/exception/ReservationErrorCode.kt @@ -0,0 +1,20 @@ +package roomescape.reservation.exception + +import org.springframework.http.HttpStatus +import roomescape.common.exception.ErrorCode + +enum class ReservationErrorCode( + override val httpStatus: HttpStatus, + override val errorCode: String, + override val message: String +) : ErrorCode { + RESERVATION_NOT_FOUND(HttpStatus.NOT_FOUND, "R001", "예약을 찾을 수 없어요."), + RESERVATION_DUPLICATED(HttpStatus.BAD_REQUEST, "R002", "이미 같은 예약이 있어요."), + ALREADY_RESERVE(HttpStatus.BAD_REQUEST, "R003", "같은 날짜, 시간, 테마에 대한 예약(대기)는 한 번만 가능해요."), + ALREADY_CONFIRMED(HttpStatus.CONFLICT, "R004", "이미 확정된 예약이에요"), + CONFIRMED_RESERVATION_ALREADY_EXISTS(HttpStatus.CONFLICT, "R005", "이미 확정된 예약이 있어서 승인할 수 없어요."), + PAST_REQUEST_DATETIME(HttpStatus.BAD_REQUEST, "R005", "과거 시간으로 예약할 수 없어요."), + NOT_RESERVATION_OWNER(HttpStatus.FORBIDDEN, "R006", "타인의 예약은 취소할 수 없어요."), + INVALID_SEARCH_DATE_RANGE(HttpStatus.BAD_REQUEST, "R007", "종료 날짜는 시작 날짜 이후여야 해요."), + NO_PERMISSION(HttpStatus.FORBIDDEN, "R008", "접근 권한이 없어요."), +} diff --git a/src/main/kotlin/roomescape/reservation/exception/ReservationException.kt b/src/main/kotlin/roomescape/reservation/exception/ReservationException.kt new file mode 100644 index 00000000..885d39c5 --- /dev/null +++ b/src/main/kotlin/roomescape/reservation/exception/ReservationException.kt @@ -0,0 +1,9 @@ +package roomescape.reservation.exception + +import roomescape.common.exception.ErrorCode +import roomescape.common.exception.RoomescapeExceptionV2 + +class ReservationException( + override val errorCode: ErrorCode, + override val message: String = errorCode.message +) : RoomescapeExceptionV2(errorCode, message)