feat(content-ranking): 랭킹 조회 언어를 전달한다

This commit is contained in:
2026-09-09 23:22:44 +09:00
parent 21f72f2827
commit e5230c0950
4 changed files with 128 additions and 11 deletions
@@ -1,5 +1,6 @@
package kr.co.vividnext.sodalive.v2.content.ranking.application
import kr.co.vividnext.sodalive.i18n.LangContext
import kr.co.vividnext.sodalive.member.Member
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
import kr.co.vividnext.sodalive.v2.common.domain.toCdnUrl
@@ -18,6 +19,7 @@ import java.time.ZonedDateTime
@Service
class AudioRankingQueryService(
private val snapshotPort: AudioRankingSnapshotPort,
private val langContext: LangContext,
private val memberContentPreferenceService: MemberContentPreferenceService,
private val blockPort: AudioRankingBlockPort,
private val jobService: AudioRankingSnapshotJobService,
@@ -29,7 +31,8 @@ class AudioRankingQueryService(
fun getRankings(type: AudioRankingType, member: Member?): AudioRanking {
val nowUtc = nowProvider().withZoneSameInstant(ZoneOffset.UTC).toLocalDateTime()
val latestSnapshots = findLatestVisibleSnapshots(type, nowUtc)
val locale = langContext.lang.code
val latestSnapshots = findLatestVisibleSnapshots(type, nowUtc, locale)
if (latestSnapshots.isEmpty()) {
return AudioRanking(showRankChange = false, type = type, items = emptyList())
}
@@ -37,7 +40,8 @@ class AudioRankingQueryService(
val previousSnapshots = snapshotPort.findPreviousVisibleSnapshots(
rankingType = type,
currentAggregationStartAtUtc = latestSnapshots.first().aggregationStartAtUtc,
nowUtc = nowUtc
nowUtc = nowUtc,
locale = locale
)
val blockedCreatorMemberIds = blockedCreatorMemberIds(member, latestSnapshots + previousSnapshots)
val latestVisibleSnapshots = latestSnapshots.visibleTo(canViewAdultContent, blockedCreatorMemberIds).take(ITEM_LIMIT)
@@ -58,9 +62,10 @@ class AudioRankingQueryService(
private fun findLatestVisibleSnapshots(
type: AudioRankingType,
nowUtc: java.time.LocalDateTime
nowUtc: java.time.LocalDateTime,
locale: String
): List<AudioRankingSnapshotRecord> {
val latestSnapshots = snapshotPort.findLatestVisibleSnapshots(type, nowUtc)
val latestSnapshots = snapshotPort.findLatestVisibleSnapshots(type, nowUtc, locale)
if (latestSnapshots.isNotEmpty()) return latestSnapshots
runCatching { jobService.refreshLastCompletedWeekByFallback(type) }
@@ -72,7 +77,7 @@ class AudioRankingQueryService(
ex
)
}
return snapshotPort.findLatestVisibleSnapshots(type, nowUtc)
return snapshotPort.findLatestVisibleSnapshots(type, nowUtc, locale)
}
private fun canViewAdultContent(member: Member?): Boolean {
@@ -6,13 +6,15 @@ import java.time.LocalDateTime
interface AudioRankingSnapshotPort {
fun findLatestVisibleSnapshots(
rankingType: AudioRankingType,
nowUtc: LocalDateTime
nowUtc: LocalDateTime,
locale: String
): List<AudioRankingSnapshotRecord>
fun findPreviousVisibleSnapshots(
rankingType: AudioRankingType,
currentAggregationStartAtUtc: LocalDateTime,
nowUtc: LocalDateTime
nowUtc: LocalDateTime,
locale: String
): List<AudioRankingSnapshotRecord>
fun replaceSnapshots(