generated from pricelees/issue-pr-template
refactor: schedule에서 사용하는 도메인에 매장 필드 추가 및 클래스명 수정(ScheduleWithTheme -> ScheduleOverview)
This commit is contained in:
parent
8c6222237b
commit
86aa4c3046
@ -11,7 +11,7 @@ import roomescape.admin.business.AdminService
|
|||||||
import roomescape.common.config.next
|
import roomescape.common.config.next
|
||||||
import roomescape.common.dto.AuditInfo
|
import roomescape.common.dto.AuditInfo
|
||||||
import roomescape.common.dto.OperatorInfo
|
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.exception.ScheduleErrorCode
|
||||||
import roomescape.schedule.infrastructure.persistence.ScheduleEntity
|
import roomescape.schedule.infrastructure.persistence.ScheduleEntity
|
||||||
import roomescape.schedule.infrastructure.persistence.ScheduleEntityFactory
|
import roomescape.schedule.infrastructure.persistence.ScheduleEntityFactory
|
||||||
@ -45,7 +45,7 @@ class ScheduleService(
|
|||||||
fun getStoreScheduleByDate(storeId: Long, date: LocalDate): ScheduleWithThemeListResponse {
|
fun getStoreScheduleByDate(storeId: Long, date: LocalDate): ScheduleWithThemeListResponse {
|
||||||
log.info { "[ScheduleService.getStoreScheduleByDate] 매장 일정 조회: storeId=${storeId}, date=$date" }
|
log.info { "[ScheduleService.getStoreScheduleByDate] 매장 일정 조회: storeId=${storeId}, date=$date" }
|
||||||
|
|
||||||
val schedules: List<ScheduleWithThemeSummary> =
|
val schedules: List<ScheduleOverview> =
|
||||||
scheduleRepository.findStoreSchedulesWithThemeByDate(storeId, date)
|
scheduleRepository.findStoreSchedulesWithThemeByDate(storeId, date)
|
||||||
|
|
||||||
return schedules.toResponse()
|
return schedules.toResponse()
|
||||||
@ -78,7 +78,7 @@ class ScheduleService(
|
|||||||
|
|
||||||
val searchDate = date ?: LocalDate.now()
|
val searchDate = date ?: LocalDate.now()
|
||||||
|
|
||||||
val schedules: List<ScheduleWithThemeSummary> =
|
val schedules: List<ScheduleOverview> =
|
||||||
scheduleRepository.findStoreSchedulesWithThemeByDate(storeId, searchDate)
|
scheduleRepository.findStoreSchedulesWithThemeByDate(storeId, searchDate)
|
||||||
.filter { (themeId == null) || (it.themeId == themeId) }
|
.filter { (themeId == null) || (it.themeId == themeId) }
|
||||||
.sortedBy { it.time }
|
.sortedBy { it.time }
|
||||||
|
|||||||
@ -5,8 +5,10 @@ import roomescape.theme.infrastructure.persistence.Difficulty
|
|||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
|
|
||||||
class ScheduleWithThemeSummary(
|
class ScheduleOverview(
|
||||||
val id: Long,
|
val id: Long,
|
||||||
|
val storeId: Long,
|
||||||
|
val storeName: String,
|
||||||
val date: LocalDate,
|
val date: LocalDate,
|
||||||
val time: LocalTime,
|
val time: LocalTime,
|
||||||
val themeId: Long,
|
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.JpaRepository
|
||||||
import org.springframework.data.jpa.repository.Query
|
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.LocalDate
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
|
|
||||||
@ -24,8 +24,10 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
|||||||
@Query(
|
@Query(
|
||||||
"""
|
"""
|
||||||
SELECT
|
SELECT
|
||||||
new roomescape.schedule.business.domain.ScheduleWithThemeSummary(
|
new roomescape.schedule.business.domain.ScheduleOverview(
|
||||||
s._id,
|
s._id,
|
||||||
|
st._id,
|
||||||
|
st.name,
|
||||||
s.date,
|
s.date,
|
||||||
s.time,
|
s.time,
|
||||||
t._id,
|
t._id,
|
||||||
@ -38,6 +40,8 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
|||||||
ScheduleEntity s
|
ScheduleEntity s
|
||||||
JOIN
|
JOIN
|
||||||
ThemeEntity t ON t._id = s.themeId
|
ThemeEntity t ON t._id = s.themeId
|
||||||
|
JOIN
|
||||||
|
StoreEntity st ON st._id = s.storeId
|
||||||
WHERE
|
WHERE
|
||||||
s.storeId = :storeId
|
s.storeId = :storeId
|
||||||
AND s.date = :date
|
AND s.date = :date
|
||||||
@ -48,5 +52,5 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
|||||||
storeId: Long,
|
storeId: Long,
|
||||||
date: LocalDate,
|
date: LocalDate,
|
||||||
themeId: Long? = null
|
themeId: Long? = null
|
||||||
): List<ScheduleWithThemeSummary>
|
): List<ScheduleOverview>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package roomescape.schedule.web
|
package roomescape.schedule.web
|
||||||
|
|
||||||
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
import roomescape.schedule.business.domain.ScheduleOverview
|
||||||
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
@ -16,7 +16,7 @@ data class AdminScheduleSummaryResponse(
|
|||||||
val status: ScheduleStatus,
|
val status: ScheduleStatus,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ScheduleWithThemeSummary.toAdminSummaryResponse() = AdminScheduleSummaryResponse(
|
fun ScheduleOverview.toAdminSummaryResponse() = AdminScheduleSummaryResponse(
|
||||||
id = this.id,
|
id = this.id,
|
||||||
themeName = this.themeName,
|
themeName = this.themeName,
|
||||||
startFrom = this.time,
|
startFrom = this.time,
|
||||||
@ -28,7 +28,7 @@ data class AdminScheduleSummaryListResponse(
|
|||||||
val schedules: List<AdminScheduleSummaryResponse>
|
val schedules: List<AdminScheduleSummaryResponse>
|
||||||
)
|
)
|
||||||
|
|
||||||
fun List<ScheduleWithThemeSummary>.toAdminSummaryListResponse() = AdminScheduleSummaryListResponse(
|
fun List<ScheduleOverview>.toAdminSummaryListResponse() = AdminScheduleSummaryListResponse(
|
||||||
this.map { it.toAdminSummaryResponse() }
|
this.map { it.toAdminSummaryResponse() }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package roomescape.schedule.web
|
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.ScheduleEntity
|
||||||
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
||||||
import roomescape.theme.infrastructure.persistence.Difficulty
|
import roomescape.theme.infrastructure.persistence.Difficulty
|
||||||
@ -20,7 +20,7 @@ data class ScheduleWithThemeResponse(
|
|||||||
val status: ScheduleStatus
|
val status: ScheduleStatus
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ScheduleWithThemeSummary.toResponse() = ScheduleWithThemeResponse(
|
fun ScheduleOverview.toResponse() = ScheduleWithThemeResponse(
|
||||||
id = this.id,
|
id = this.id,
|
||||||
startFrom = this.time,
|
startFrom = this.time,
|
||||||
endAt = this.getEndAt(),
|
endAt = this.getEndAt(),
|
||||||
@ -34,7 +34,7 @@ data class ScheduleWithThemeListResponse(
|
|||||||
val schedules: List<ScheduleWithThemeResponse>
|
val schedules: List<ScheduleWithThemeResponse>
|
||||||
)
|
)
|
||||||
|
|
||||||
fun List<ScheduleWithThemeSummary>.toResponse() = ScheduleWithThemeListResponse(
|
fun List<ScheduleOverview>.toResponse() = ScheduleWithThemeListResponse(
|
||||||
this.map { it.toResponse() }
|
this.map { it.toResponse() }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user