generated from pricelees/issue-pr-template
[#44] 매장 기능 도입 #45
@ -11,7 +11,7 @@ import roomescape.admin.business.AdminService
|
||||
import roomescape.common.config.next
|
||||
import roomescape.common.dto.AuditInfo
|
||||
import roomescape.common.dto.OperatorInfo
|
||||
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
||||
import roomescape.schedule.business.domain.ScheduleOverview
|
||||
import roomescape.schedule.exception.ScheduleErrorCode
|
||||
import roomescape.schedule.infrastructure.persistence.ScheduleEntity
|
||||
import roomescape.schedule.infrastructure.persistence.ScheduleEntityFactory
|
||||
@ -45,7 +45,7 @@ class ScheduleService(
|
||||
fun getStoreScheduleByDate(storeId: Long, date: LocalDate): ScheduleWithThemeListResponse {
|
||||
log.info { "[ScheduleService.getStoreScheduleByDate] 매장 일정 조회: storeId=${storeId}, date=$date" }
|
||||
|
||||
val schedules: List<ScheduleWithThemeSummary> =
|
||||
val schedules: List<ScheduleOverview> =
|
||||
scheduleRepository.findStoreSchedulesWithThemeByDate(storeId, date)
|
||||
|
||||
return schedules.toResponse()
|
||||
@ -78,7 +78,7 @@ class ScheduleService(
|
||||
|
||||
val searchDate = date ?: LocalDate.now()
|
||||
|
||||
val schedules: List<ScheduleWithThemeSummary> =
|
||||
val schedules: List<ScheduleOverview> =
|
||||
scheduleRepository.findStoreSchedulesWithThemeByDate(storeId, searchDate)
|
||||
.filter { (themeId == null) || (it.themeId == themeId) }
|
||||
.sortedBy { it.time }
|
||||
|
||||
@ -5,8 +5,10 @@ import roomescape.theme.infrastructure.persistence.Difficulty
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalTime
|
||||
|
||||
class ScheduleWithThemeSummary(
|
||||
class ScheduleOverview(
|
||||
val id: Long,
|
||||
val storeId: Long,
|
||||
val storeName: String,
|
||||
val date: LocalDate,
|
||||
val time: LocalTime,
|
||||
val themeId: Long,
|
||||
@ -2,7 +2,7 @@ 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 roomescape.schedule.business.domain.ScheduleOverview
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalTime
|
||||
|
||||
@ -24,8 +24,10 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
||||
@Query(
|
||||
"""
|
||||
SELECT
|
||||
new roomescape.schedule.business.domain.ScheduleWithThemeSummary(
|
||||
new roomescape.schedule.business.domain.ScheduleOverview(
|
||||
s._id,
|
||||
st._id,
|
||||
st.name,
|
||||
s.date,
|
||||
s.time,
|
||||
t._id,
|
||||
@ -38,6 +40,8 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
||||
ScheduleEntity s
|
||||
JOIN
|
||||
ThemeEntity t ON t._id = s.themeId
|
||||
JOIN
|
||||
StoreEntity st ON st._id = s.storeId
|
||||
WHERE
|
||||
s.storeId = :storeId
|
||||
AND s.date = :date
|
||||
@ -48,5 +52,5 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
||||
storeId: Long,
|
||||
date: LocalDate,
|
||||
themeId: Long? = null
|
||||
): List<ScheduleWithThemeSummary>
|
||||
): List<ScheduleOverview>
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package roomescape.schedule.web
|
||||
|
||||
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
||||
import roomescape.schedule.business.domain.ScheduleOverview
|
||||
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalTime
|
||||
@ -16,7 +16,7 @@ data class AdminScheduleSummaryResponse(
|
||||
val status: ScheduleStatus,
|
||||
)
|
||||
|
||||
fun ScheduleWithThemeSummary.toAdminSummaryResponse() = AdminScheduleSummaryResponse(
|
||||
fun ScheduleOverview.toAdminSummaryResponse() = AdminScheduleSummaryResponse(
|
||||
id = this.id,
|
||||
themeName = this.themeName,
|
||||
startFrom = this.time,
|
||||
@ -28,7 +28,7 @@ data class AdminScheduleSummaryListResponse(
|
||||
val schedules: List<AdminScheduleSummaryResponse>
|
||||
)
|
||||
|
||||
fun List<ScheduleWithThemeSummary>.toAdminSummaryListResponse() = AdminScheduleSummaryListResponse(
|
||||
fun List<ScheduleOverview>.toAdminSummaryListResponse() = AdminScheduleSummaryListResponse(
|
||||
this.map { it.toAdminSummaryResponse() }
|
||||
)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package roomescape.schedule.web
|
||||
|
||||
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
||||
import roomescape.schedule.business.domain.ScheduleOverview
|
||||
import roomescape.schedule.infrastructure.persistence.ScheduleEntity
|
||||
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
||||
import roomescape.theme.infrastructure.persistence.Difficulty
|
||||
@ -20,7 +20,7 @@ data class ScheduleWithThemeResponse(
|
||||
val status: ScheduleStatus
|
||||
)
|
||||
|
||||
fun ScheduleWithThemeSummary.toResponse() = ScheduleWithThemeResponse(
|
||||
fun ScheduleOverview.toResponse() = ScheduleWithThemeResponse(
|
||||
id = this.id,
|
||||
startFrom = this.time,
|
||||
endAt = this.getEndAt(),
|
||||
@ -34,7 +34,7 @@ data class ScheduleWithThemeListResponse(
|
||||
val schedules: List<ScheduleWithThemeResponse>
|
||||
)
|
||||
|
||||
fun List<ScheduleWithThemeSummary>.toResponse() = ScheduleWithThemeListResponse(
|
||||
fun List<ScheduleOverview>.toResponse() = ScheduleWithThemeListResponse(
|
||||
this.map { it.toResponse() }
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user