fix(content-ranking): 랭킹 커버 이미지를 CDN URL로 변환한다
This commit is contained in:
@@ -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)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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")) }
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user