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

Merged
pricelees merged 116 commits from feat/#44 into main 2025-09-20 03:15:06 +00:00
3 changed files with 57 additions and 0 deletions
Showing only changes of commit 5a6f7c4763 - Show all commits

View File

@ -69,6 +69,16 @@ class ScheduleService(
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_AVAILABLE) throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_AVAILABLE)
} }
@Transactional(readOnly = true)
fun findScheduleOverviewById(id: Long): ScheduleOverviewResponse {
val overview: ScheduleOverview = scheduleRepository.findOverviewByIdOrNull(id) ?: run {
log.warn { "[ScheduleService.findScheduleOverview] 일정 개요 조회 실패: id=$id" }
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
}
return overview.toOverviewResponse()
}
// ======================================== // ========================================
// All-Admin (본사, 매장 모두 사용가능) // All-Admin (본사, 매장 모두 사용가능)
// ======================================== // ========================================

View File

@ -53,4 +53,29 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
date: LocalDate, date: LocalDate,
themeId: Long? = null themeId: Long? = null
): List<ScheduleOverview> ): List<ScheduleOverview>
@Query("""
SELECT
new roomescape.schedule.business.domain.ScheduleOverview(
s._id,
st._id,
st.name,
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
JOIN
StoreEntity st ON st._id = s.storeId
WHERE
s._id = :id
""")
fun findOverviewByIdOrNull(id: Long): ScheduleOverview?
} }

View File

@ -54,3 +54,25 @@ fun ScheduleEntity.toSummaryResponse() = ScheduleSummaryResponse(
themeId = this.themeId, themeId = this.themeId,
status = this.status status = this.status
) )
data class ScheduleOverviewResponse(
val id: Long,
val storeId: Long,
val storeName: String,
val date: LocalDate,
val startFrom: LocalTime,
val endAt: LocalTime,
val themeId: Long,
val themeName: String,
)
fun ScheduleOverview.toOverviewResponse() = ScheduleOverviewResponse(
id = this.id,
storeId = this.storeId,
storeName = this.storeName,
date = this.date,
startFrom = this.time,
endAt = this.getEndAt(),
themeId = this.themeId,
themeName = this.themeName,
)