diff --git a/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleFindService.kt b/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleFindService.kt index cca00d5..a1629f9 100644 --- a/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleFindService.kt +++ b/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleFindService.kt @@ -14,5 +14,16 @@ class ScheduleFindService( fun findSchedulesBetween( from: LocalDate, toInclusive: LocalDate - ): List = scheduleRepository.findScheduleEntitiesByDateBetween(from, toInclusive) + ): List = + scheduleRepository + .findAll { + select(entity(ScheduleEntity::class)) + .from(entity(ScheduleEntity::class)) + .where( + and( + path(ScheduleEntity::date).greaterThanOrEqualTo(from), + path(ScheduleEntity::date).lessThanOrEqualTo(toInclusive) + ) + ) + }.filterNotNull() } diff --git a/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleRepository.kt b/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleRepository.kt index e86b3f9..b590423 100644 --- a/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleRepository.kt +++ b/src/main/kotlin/co/yappuworld/schedule/infrastructure/ScheduleRepository.kt @@ -4,7 +4,6 @@ import co.yappuworld.schedule.infrastructure.entity.ScheduleEntity import co.yappuworld.schedule.infrastructure.entity.SessionEntity import com.linecorp.kotlinjdsl.support.spring.data.jpa.repository.KotlinJdslJpqlExecutor import org.springframework.data.jpa.repository.JpaRepository -import java.time.LocalDate import java.util.UUID interface ScheduleRepository : @@ -13,13 +12,4 @@ interface ScheduleRepository : KotlinJdslJpqlExecutor { fun findAllByIdIn(ids: List): List - - /** - * @param from Inclusive - * @param to Inclusive - */ - fun findScheduleEntitiesByDateBetween( - from: LocalDate, - to: LocalDate - ): List }