generated from pricelees/issue-pr-template
[#44] 매장 기능 도입 #45
55
src/main/kotlin/roomescape/schedule/web/AdminScheduleDto.kt
Normal file
55
src/main/kotlin/roomescape/schedule/web/AdminScheduleDto.kt
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package roomescape.schedule.web
|
||||||
|
|
||||||
|
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
||||||
|
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.LocalTime
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// All-Admin DTO (본사 + 매장)
|
||||||
|
// ========================================
|
||||||
|
data class AdminScheduleSummaryResponse(
|
||||||
|
val id: Long,
|
||||||
|
val themeName: String,
|
||||||
|
val startFrom: LocalTime,
|
||||||
|
val endAt: LocalTime,
|
||||||
|
val status: ScheduleStatus,
|
||||||
|
)
|
||||||
|
|
||||||
|
fun ScheduleWithThemeSummary.toAdminSummaryResponse() = AdminScheduleSummaryResponse(
|
||||||
|
id = this.id,
|
||||||
|
themeName = this.themeName,
|
||||||
|
startFrom = this.time,
|
||||||
|
endAt = this.getEndAt(),
|
||||||
|
status = this.status
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AdminScheduleSummaryListResponse(
|
||||||
|
val schedules: List<AdminScheduleSummaryResponse>
|
||||||
|
)
|
||||||
|
|
||||||
|
fun List<ScheduleWithThemeSummary>.toAdminSummaryListResponse() = AdminScheduleSummaryListResponse(
|
||||||
|
this.map { it.toAdminSummaryResponse() }
|
||||||
|
)
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// Store Admin DTO (매장)
|
||||||
|
// ========================================
|
||||||
|
data class ScheduleCreateRequest(
|
||||||
|
val date: LocalDate,
|
||||||
|
val time: LocalTime,
|
||||||
|
val themeId: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ScheduleCreateResponse(
|
||||||
|
val id: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ScheduleUpdateRequest(
|
||||||
|
val time: LocalTime? = null,
|
||||||
|
val status: ScheduleStatus? = null
|
||||||
|
) {
|
||||||
|
fun isAllParamsNull(): Boolean {
|
||||||
|
return time == null && status == null
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,71 +1,46 @@
|
|||||||
package roomescape.schedule.web
|
package roomescape.schedule.web
|
||||||
|
|
||||||
import roomescape.common.dto.OperatorInfo
|
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
||||||
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 java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
|
|
||||||
data class AvailableThemeIdListResponse(
|
// ========================================
|
||||||
val themeIds: List<Long>
|
// Public (인증 불필요)
|
||||||
)
|
// ========================================
|
||||||
|
data class ScheduleWithThemeResponse(
|
||||||
data class ScheduleByDateResponse(
|
|
||||||
val id: Long,
|
val id: Long,
|
||||||
val time: LocalTime,
|
val startFrom: LocalTime,
|
||||||
|
val endAt: LocalTime,
|
||||||
|
val themeId: Long,
|
||||||
|
val themeName: String,
|
||||||
|
val themeDifficulty: Difficulty,
|
||||||
val status: ScheduleStatus
|
val status: ScheduleStatus
|
||||||
)
|
)
|
||||||
|
|
||||||
data class ScheduleListByDateResponse(
|
fun ScheduleWithThemeSummary.toResponse() = ScheduleWithThemeResponse(
|
||||||
val schedules: List<ScheduleByDateResponse>
|
|
||||||
)
|
|
||||||
|
|
||||||
fun List<ScheduleEntity>.toListResponse() = ScheduleListByDateResponse(
|
|
||||||
this.map { ScheduleByDateResponse(it.id, it.time, it.status) }
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ScheduleCreateRequest(
|
|
||||||
val date: LocalDate,
|
|
||||||
val time: LocalTime,
|
|
||||||
val themeId: Long
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ScheduleCreateResponse(
|
|
||||||
val id: Long
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ScheduleUpdateRequest(
|
|
||||||
val time: LocalTime? = null,
|
|
||||||
val status: ScheduleStatus? = null
|
|
||||||
) {
|
|
||||||
fun isAllParamsNull(): Boolean {
|
|
||||||
return time == null && status == null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class ScheduleDetailResponse(
|
|
||||||
val id: Long,
|
|
||||||
val date: LocalDate,
|
|
||||||
val time: LocalTime,
|
|
||||||
val status: ScheduleStatus,
|
|
||||||
val createdAt: LocalDateTime,
|
|
||||||
val createdBy: OperatorInfo,
|
|
||||||
val updatedAt: LocalDateTime,
|
|
||||||
val updatedBy: OperatorInfo,
|
|
||||||
)
|
|
||||||
|
|
||||||
fun ScheduleEntity.toDetailResponse(createdBy: OperatorInfo, updatedBy: OperatorInfo) = ScheduleDetailResponse(
|
|
||||||
id = this.id,
|
id = this.id,
|
||||||
date = this.date,
|
startFrom = this.time,
|
||||||
time = this.time,
|
endAt = this.getEndAt(),
|
||||||
status = this.status,
|
themeId = this.themeId,
|
||||||
createdAt = this.createdAt,
|
themeName = this.themeName,
|
||||||
createdBy = createdBy,
|
themeDifficulty = this.themeDifficulty,
|
||||||
updatedAt = this.updatedAt,
|
status = this.status
|
||||||
updatedBy = updatedBy
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class ScheduleWithThemeListResponse(
|
||||||
|
val schedules: List<ScheduleWithThemeResponse>
|
||||||
|
)
|
||||||
|
|
||||||
|
fun List<ScheduleWithThemeSummary>.toResponse() = ScheduleWithThemeListResponse(
|
||||||
|
this.map { it.toResponse() }
|
||||||
|
)
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// Other-Service (API 없이 다른 서비스에서 호출)
|
||||||
|
// ========================================
|
||||||
data class ScheduleSummaryResponse(
|
data class ScheduleSummaryResponse(
|
||||||
val date: LocalDate,
|
val date: LocalDate,
|
||||||
val time: LocalTime,
|
val time: LocalTime,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user