feat(content-ranking): 랭킹 공개 시각 정책을 추가한다

This commit is contained in:
2026-06-24 12:37:26 +09:00
parent d62ce35912
commit dc93f9845b
2 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package kr.co.vividnext.sodalive.v2.content.ranking.domain
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.ZoneId
class AudioRankingSchedulePolicy {
fun resolveVisibleFromAt(aggregationEndAtKst: LocalDateTime): LocalDateTime {
return aggregationEndAtKst.toLocalDate()
.atTime(VISIBLE_FROM_TIME)
.atZone(KST_ZONE)
.withZoneSameInstant(UTC_ZONE)
.toLocalDateTime()
}
fun isVisible(visibleFromAtUtc: LocalDateTime, nowUtc: LocalDateTime): Boolean {
return !nowUtc.isBefore(visibleFromAtUtc)
}
companion object {
private val KST_ZONE: ZoneId = ZoneId.of("Asia/Seoul")
private val UTC_ZONE: ZoneId = ZoneId.of("UTC")
private val VISIBLE_FROM_TIME: LocalTime = LocalTime.of(9, 0)
}
}