Compare commits

...

2 Commits

1 changed files with 10 additions and 7 deletions

View File

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