diff --git a/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTime.kt b/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTime.kt index 1afef9668..b6b43b374 100644 --- a/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTime.kt +++ b/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTime.kt @@ -25,11 +25,10 @@ data class OutingAvailableTime( ) : SchoolIdDomain { fun checkAvailable( - dayOfWeek: DayOfWeek, outingTime: LocalTime, arrivalTime: LocalTime, ) { - if (this.dayOfWeek != dayOfWeek || + if ( this.outingTime.isAfter(outingTime) || this.arrivalTime.isBefore(arrivalTime) ) { diff --git a/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/service/CheckOutingServiceImpl.kt b/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/service/CheckOutingServiceImpl.kt index 954e47dcf..48cc9637e 100644 --- a/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/service/CheckOutingServiceImpl.kt +++ b/dms-core/src/main/kotlin/team/aliens/dms/domain/outing/service/CheckOutingServiceImpl.kt @@ -43,8 +43,8 @@ class CheckOutingServiceImpl( arrivalTime: LocalTime ) { queryOutingAvailableTimePort.queryOutingAvailableTimeByDayOfWeek(outingDate.dayOfWeek) - ?.checkAvailable(outingDate.dayOfWeek, outingTime, arrivalTime) - ?: throw OutingAvailableTimeMismatchException + ?.checkAvailable(outingTime, arrivalTime) + ?:throw OutingAvailableTimeMismatchException } override fun checkOutingTypeExists(outingType: OutingType) { diff --git a/dms-core/src/test/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTimeTest.kt b/dms-core/src/test/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTimeTest.kt index f969c61bd..09dceeb08 100644 --- a/dms-core/src/test/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTimeTest.kt +++ b/dms-core/src/test/kotlin/team/aliens/dms/domain/outing/model/OutingAvailableTimeTest.kt @@ -21,7 +21,6 @@ class OutingAvailableTimeTest : DescribeSpec({ it("외출 신청이 가능하다") { shouldNotThrowAny { outingAvailableTime.checkAvailable( - dayOfWeek = DayOfWeek.SUNDAY, outingTime = LocalTime.of(12, 0, 0), arrivalTime = LocalTime.of(20, 30, 0) ) @@ -29,23 +28,10 @@ class OutingAvailableTimeTest : DescribeSpec({ } } - context("외출하는 날이 아닐 때 외출 신청을 하면") { - it("예외가 발생한다") { - shouldThrow { - outingAvailableTime.checkAvailable( - dayOfWeek = DayOfWeek.SATURDAY, - outingTime = LocalTime.of(14, 0, 0), - arrivalTime = LocalTime.of(20, 0, 0) - ) - } - } - } - context("외출 가능 시간 전에 외출 신청을 하면") { it("예외가 발생한다") { shouldThrow { outingAvailableTime.checkAvailable( - dayOfWeek = DayOfWeek.SATURDAY, outingTime = LocalTime.of(11, 59, 59), arrivalTime = LocalTime.of(20, 0, 0) ) @@ -57,7 +43,6 @@ class OutingAvailableTimeTest : DescribeSpec({ it("예외가 발생한다") { shouldThrow { outingAvailableTime.checkAvailable( - dayOfWeek = DayOfWeek.SATURDAY, outingTime = LocalTime.of(14, 0, 0), arrivalTime = LocalTime.of(20, 30, 1) )