From 4f3f8d1fa7c2b317a5f98fe3f8ca56001440de3e Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 25 Jun 2026 16:02:58 +0900 Subject: [PATCH] =?UTF-8?q?fix(content-ranking):=20=EB=9E=AD=ED=82=B9=20?= =?UTF-8?q?=EC=BB=A4=EB=B2=84=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20CDN?= =?UTF-8?q?=20URL=EB=A1=9C=20=EB=B3=80=ED=99=98=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/ranking/application/AudioRankingQueryService.kt | 6 +++++- .../ranking/application/AudioRankingQueryServiceTest.kt | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryService.kt index 76e1969b..76d566e1 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryService.kt @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.v2.content.ranking.application import kr.co.vividnext.sodalive.member.Member import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService +import kr.co.vividnext.sodalive.v2.common.domain.toCdnUrl import kr.co.vividnext.sodalive.v2.content.ranking.domain.AudioRanking import kr.co.vividnext.sodalive.v2.content.ranking.domain.AudioRankingItem import kr.co.vividnext.sodalive.v2.content.ranking.domain.AudioRankingType @@ -9,6 +10,7 @@ import kr.co.vividnext.sodalive.v2.content.ranking.port.out.AudioRankingBlockPor import kr.co.vividnext.sodalive.v2.content.ranking.port.out.AudioRankingSnapshotPort import kr.co.vividnext.sodalive.v2.content.ranking.port.out.AudioRankingSnapshotRecord import org.slf4j.LoggerFactory +import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service import java.time.ZoneOffset import java.time.ZonedDateTime @@ -19,6 +21,8 @@ class AudioRankingQueryService( private val memberContentPreferenceService: MemberContentPreferenceService, private val blockPort: AudioRankingBlockPort, private val jobService: AudioRankingSnapshotJobService, + @Value("\${cloud.aws.cloud-front.host}") + private val cloudFrontHost: String, private val nowProvider: () -> ZonedDateTime = { ZonedDateTime.now() } ) { private val log = LoggerFactory.getLogger(javaClass) @@ -105,7 +109,7 @@ class AudioRankingQueryService( rank = rank, rankChange = if (showRankChange && previousRank != null) previousRank - rank else null, isNew = showRankChange && previousRank == null, - coverImageUrl = coverImageUrl + coverImageUrl = coverImageUrl.toCdnUrl(cloudFrontHost) ) } diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryServiceTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryServiceTest.kt index fd90d266..48c00c36 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryServiceTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/content/ranking/application/AudioRankingQueryServiceTest.kt @@ -54,6 +54,10 @@ class AudioRankingQueryServiceTest { assertEquals(listOf(1, 2, 3), result.items.map { it.rank }) assertEquals(listOf(1, -1, null), result.items.map { it.rankChange }) assertEquals(listOf(false, false, true), result.items.map { it.isNew }) + assertEquals( + listOf("https://cdn.test/cover-2.png", "https://cdn.test/cover-1.png", "https://cdn.test/cover-3.png"), + result.items.map { it.coverImageUrl } + ) assertEquals(LocalDateTime.of(2026, 6, 8, 0, 0), snapshotPort.nowUtc) assertEquals(LocalDateTime.of(2026, 5, 31, 15, 0), snapshotPort.currentAggregationStartAtUtc) } @@ -230,6 +234,7 @@ class AudioRankingQueryServiceTest { memberContentPreferenceService = memberContentPreferenceService, blockPort = blockPort, jobService = jobService, + cloudFrontHost = "https://cdn.test", nowProvider = { ZonedDateTime.of(2026, 6, 8, 9, 0, 0, 0, ZoneId.of("Asia/Seoul")) } ) }