Compare commits

..

2 Commits

View File

@@ -12,8 +12,7 @@ data class CreatePointRewardPolicyRequest(
val threshold: Int,
val pointAmount: Int,
val startDate: String,
val endDate: String,
val isActive: Boolean
val endDate: String
) {
fun toEntity(): PointRewardPolicy {
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
@@ -27,11 +26,15 @@ data class CreatePointRewardPolicyRequest(
.atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime(),
endDate = LocalDateTime.parse(endDate, dateTimeFormatter).withSecond(59)
.atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime(),
isActive = isActive
endDate = if (endDate.isNotBlank()) {
LocalDateTime.parse(endDate, dateTimeFormatter).withSecond(59)
.atZone(ZoneId.of("Asia/Seoul"))
.withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime()
} else {
null
},
isActive = true
)
}
}