[#44] 매장 기능 도입 #45

Merged
pricelees merged 116 commits from feat/#44 into main 2025-09-20 03:15:06 +00:00
Showing only changes of commit eec279c76f - Show all commits

View File

@ -2,23 +2,40 @@ package roomescape.schedule.infrastructure.persistence
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
import java.time.LocalDate
import java.time.LocalTime
interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
fun findAllByDate(date: LocalDate): List<ScheduleEntity>
fun findAllByDateAndThemeId(date: LocalDate, themeId: Long): List<ScheduleEntity>
fun existsByDateAndThemeIdAndTime(date: LocalDate, themeId: Long, time: LocalTime): Boolean
@Query(
"""
SELECT DISTINCT s.themeId
FROM ScheduleEntity s
WHERE s.date = :date
"""
SELECT
new roomescape.schedule.business.domain.ScheduleWithThemeSummary(
s._id,
s.date,
s.time,
t._id,
t.name,
t.difficulty,
t.availableMinutes,
s.status
)
FROM
ScheduleEntity s
JOIN
ThemeEntity t ON t._id = s.themeId
WHERE
s.storeId = :storeId
AND s.date = :date
AND (:themeId IS NULL OR s.themeId = :themeId)
"""
)
fun findAllUniqueThemeIdByDate(date: LocalDate): List<Long>
fun findStoreSchedulesWithThemeByDate(
storeId: Long,
date: LocalDate,
themeId: Long? = null
): List<ScheduleWithThemeSummary>
}