generated from pricelees/issue-pr-template
169 lines
4.9 KiB
Kotlin
169 lines
4.9 KiB
Kotlin
package roomescape.theme.web
|
|
|
|
import roomescape.theme.infrastructure.persistence.v2.Difficulty
|
|
import roomescape.theme.infrastructure.persistence.v2.ThemeEntityV2
|
|
import java.time.LocalDateTime
|
|
|
|
data class ThemeCreateRequestV2(
|
|
val name: String,
|
|
val description: String,
|
|
val thumbnailUrl: String,
|
|
val difficulty: Difficulty,
|
|
val price: Int,
|
|
val minParticipants: Short,
|
|
val maxParticipants: Short,
|
|
val availableMinutes: Short,
|
|
val expectedMinutesFrom: Short,
|
|
val expectedMinutesTo: Short,
|
|
val isOpen: Boolean
|
|
)
|
|
|
|
data class ThemeCreateResponseV2(
|
|
val id: Long
|
|
)
|
|
|
|
fun ThemeCreateRequestV2.toEntity(id: Long) = ThemeEntityV2(
|
|
id = id,
|
|
name = this.name,
|
|
description = this.description,
|
|
thumbnailUrl = this.thumbnailUrl,
|
|
difficulty = this.difficulty,
|
|
price = this.price,
|
|
minParticipants = this.minParticipants,
|
|
maxParticipants = this.maxParticipants,
|
|
availableMinutes = this.availableMinutes,
|
|
expectedMinutesFrom = this.expectedMinutesFrom,
|
|
expectedMinutesTo = this.expectedMinutesTo,
|
|
isOpen = this.isOpen
|
|
)
|
|
|
|
data class ThemeUpdateRequest(
|
|
val name: String? = null,
|
|
val description: String? = null,
|
|
val thumbnailUrl: String? = null,
|
|
val difficulty: Difficulty? = null,
|
|
val price: Int? = null,
|
|
val minParticipants: Short? = null,
|
|
val maxParticipants: Short? = null,
|
|
val availableMinutes: Short? = null,
|
|
val expectedMinutesFrom: Short? = null,
|
|
val expectedMinutesTo: Short? = null,
|
|
val isOpen: Boolean? = null,
|
|
) {
|
|
fun isAllParamsNull(): Boolean {
|
|
return name == null &&
|
|
description == null &&
|
|
thumbnailUrl == null &&
|
|
difficulty == null &&
|
|
price == null &&
|
|
minParticipants == null &&
|
|
maxParticipants == null &&
|
|
availableMinutes == null &&
|
|
expectedMinutesFrom == null &&
|
|
expectedMinutesTo == null &&
|
|
isOpen == null
|
|
}
|
|
}
|
|
|
|
data class AdminThemeSummaryRetrieveResponse(
|
|
val id: Long,
|
|
val name: String,
|
|
val difficulty: Difficulty,
|
|
val price: Int,
|
|
val isOpen: Boolean
|
|
)
|
|
|
|
fun ThemeEntityV2.toAdminThemeSummaryResponse() = AdminThemeSummaryRetrieveResponse(
|
|
id = this.id,
|
|
name = this.name,
|
|
difficulty = this.difficulty,
|
|
price = this.price,
|
|
isOpen = this.isOpen
|
|
)
|
|
|
|
data class AdminThemeSummaryRetrieveListResponse(
|
|
val themes: List<AdminThemeSummaryRetrieveResponse>
|
|
)
|
|
|
|
fun List<ThemeEntityV2>.toAdminThemeSummaryListResponse() = AdminThemeSummaryRetrieveListResponse(
|
|
themes = this.map { it.toAdminThemeSummaryResponse() }
|
|
)
|
|
|
|
data class AdminThemeDetailRetrieveResponse(
|
|
val id: Long,
|
|
val name: String,
|
|
val description: String,
|
|
val thumbnailUrl: String,
|
|
val difficulty: Difficulty,
|
|
val price: Int,
|
|
val minParticipants: Short,
|
|
val maxParticipants: Short,
|
|
val availableMinutes: Short,
|
|
val expectedMinutesFrom: Short,
|
|
val expectedMinutesTo: Short,
|
|
val isOpen: Boolean,
|
|
val createdAt: LocalDateTime,
|
|
val createdBy: String,
|
|
val updatedAt: LocalDateTime,
|
|
val updatedBy: String,
|
|
)
|
|
|
|
fun ThemeEntityV2.toAdminThemeDetailResponse(createUserName: String, updateUserName: String) =
|
|
AdminThemeDetailRetrieveResponse(
|
|
id = this.id,
|
|
name = this.name,
|
|
description = this.description,
|
|
thumbnailUrl = this.thumbnailUrl,
|
|
difficulty = this.difficulty,
|
|
price = this.price,
|
|
minParticipants = this.minParticipants,
|
|
maxParticipants = this.maxParticipants,
|
|
availableMinutes = this.availableMinutes,
|
|
expectedMinutesFrom = this.expectedMinutesFrom,
|
|
expectedMinutesTo = this.expectedMinutesTo,
|
|
isOpen = this.isOpen,
|
|
createdAt = this.createdAt,
|
|
createdBy = createUserName,
|
|
updatedAt = this.updatedAt,
|
|
updatedBy = updateUserName
|
|
)
|
|
|
|
data class ThemeListRetrieveRequest(
|
|
val themeIds: List<Long>
|
|
)
|
|
|
|
data class ThemeRetrieveResponseV2(
|
|
val id: Long,
|
|
val name: String,
|
|
val thumbnailUrl: String,
|
|
val description: String,
|
|
val difficulty: Difficulty,
|
|
val price: Int,
|
|
val minParticipants: Short,
|
|
val maxParticipants: Short,
|
|
val availableMinutes: Short,
|
|
val expectedMinutesFrom: Short,
|
|
val expectedMinutesTo: Short
|
|
)
|
|
|
|
fun ThemeEntityV2.toRetrieveResponse() = ThemeRetrieveResponseV2(
|
|
id = this.id,
|
|
name = this.name,
|
|
thumbnailUrl = this.thumbnailUrl,
|
|
description = this.description,
|
|
difficulty = this.difficulty,
|
|
price = this.price,
|
|
minParticipants = this.minParticipants,
|
|
maxParticipants = this.maxParticipants,
|
|
availableMinutes = this.availableMinutes,
|
|
expectedMinutesFrom = this.expectedMinutesFrom,
|
|
expectedMinutesTo = this.expectedMinutesTo
|
|
)
|
|
|
|
data class ThemeRetrieveListResponseV2(
|
|
val themes: List<ThemeRetrieveResponseV2>
|
|
)
|
|
|
|
fun List<ThemeEntityV2>.toRetrieveListResponse() = ThemeRetrieveListResponseV2(
|
|
themes = this.map { it.toRetrieveResponse() }
|
|
) |