Skip to content

Commit

Permalink
merge: (#770) 외출 조회 제약조건
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 authored Sep 27, 2024
2 parents 3879229 + 1098550 commit 93c2b35
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ interface CheckOutingService {
outingTime: LocalTime,
arrivalTime: LocalTime
)

fun checkOutingApplicationQueryAble() : Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ class CheckOutingServiceImpl(
}
}
}

override fun checkOutingApplicationQueryAble(): Boolean {
val currentTime = LocalTime.now()

return currentTime.isBefore(LocalTime.of(20, 0))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import team.aliens.dms.domain.outing.spi.vo.OutingCompanionDetailsVO
import team.aliens.dms.domain.outing.spi.vo.OutingHistoryVO
import java.time.DayOfWeek
import java.time.LocalDate
import java.time.LocalTime
import java.util.UUID

@Service
Expand All @@ -39,9 +40,10 @@ class GetOutingServiceImpl(
override fun getAllOutingApplicationVOsBetweenStartAndEnd(start: LocalDate, end: LocalDate) =
queryOutingApplicationPort.queryAllOutingApplicationVOsBetweenStartAndEnd(start, end)

override fun getCurrentOutingApplication(studentId: UUID): CurrentOutingApplicationVO =
queryOutingApplicationPort.queryCurrentOutingApplicationVO(studentId)
?: throw OutingApplicationNotFoundException
override fun getCurrentOutingApplication(studentId: UUID): CurrentOutingApplicationVO {
return queryOutingApplicationPort.queryCurrentOutingApplicationVO(studentId)
?: throw OutingApplicationNotFoundException
}

override fun getOutingHistoriesByStudentNameAndDate(
studentName: String?,
Expand All @@ -60,4 +62,5 @@ class GetOutingServiceImpl(
override fun getOutingAvailableTimeById(outingAvailableTimeId: UUID): OutingAvailableTime =
queryOutingAvailableTimePort.queryOutingAvailableTimeById(outingAvailableTimeId)
?: throw OutingAvailableTimeNotFoundException

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class GetCurrentOutingApplicationUseCase(
fun execute(): GetCurrentOutingApplicationResponse {
val student = studentService.getCurrentStudent()

outingService.checkOutingApplicationQueryAble()

val currentOutingApplicationVO = outingService.getCurrentOutingApplication(student.id)

return GetCurrentOutingApplicationResponse.of(currentOutingApplicationVO, student.name)
Expand Down

0 comments on commit 93c2b35

Please sign in to comment.