From 8a72f920f148d0a046438ce5a3eb176396fde1b4 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 9 Jun 2026 14:29:14 +0900 Subject: [PATCH] =?UTF-8?q?fix(ranking):=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20CDN=20URL=EC=9D=84=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2/ranking/application/CreatorRankingQueryService.kt | 6 +++++- .../sodalive/v2/api/home/CreatorRankingControllerTest.kt | 6 +++--- .../ranking/application/CreatorRankingQueryServiceTest.kt | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryService.kt index b1ed4b2f..84c59b9a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryService.kt @@ -143,10 +143,14 @@ class CreatorRankingQueryService( isNew = false, creatorId = creatorId, nickname = nickname, - profileImageUrl = profileImageUrl + profileImageUrl = profileImageUrl.toCdnUrl() ) } + private fun String?.toCdnUrl(): String? { + return if (isNullOrBlank()) null else "$cloudFrontHost/$this" + } + private fun CreatorRankingSnapshotCandidate.toSnapshotRecord(utcRange: CreatorRankingUtcRange): CreatorRankingSnapshotRecord { val calculatedContentLiveScore = scorePolicy.calculateContentLiveScore( liveCanAmount = liveCanAmount, diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/CreatorRankingControllerTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/CreatorRankingControllerTest.kt index f3607fe1..34950b9b 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/CreatorRankingControllerTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/api/home/CreatorRankingControllerTest.kt @@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional import java.time.LocalDateTime import javax.persistence.EntityManager -@SpringBootTest +@SpringBootTest(properties = ["cloud.aws.cloud-front.host=https://cdn.test"]) @AutoConfigureMockMvc @Transactional @ContextConfiguration(initializers = [EmbeddedRedisInitializer::class]) @@ -52,7 +52,7 @@ class CreatorRankingControllerTest @Autowired constructor( .andExpect(jsonPath("$.data.items[0].isNew").value(false)) .andExpect(jsonPath("$.data.items[0].creatorId").value(1L)) .andExpect(jsonPath("$.data.items[0].nickname").value("creator-one")) - .andExpect(jsonPath("$.data.items[0].profileImageUrl").value("profile-one.png")) + .andExpect(jsonPath("$.data.items[0].profileImageUrl").value("https://cdn.test/profile-one.png")) .andExpect(jsonPath("$.data.items[0].finalScore").doesNotExist()) .andExpect(jsonPath("$.data.items[0].aggregationStartAtUtc").doesNotExist()) .andExpect(jsonPath("$.data.items[0].aggregationEndAtUtc").doesNotExist()) @@ -95,7 +95,7 @@ class CreatorRankingControllerTest @Autowired constructor( .andExpect(jsonPath("$.data.items[0].rank").value(1)) .andExpect(jsonPath("$.data.items[0].creatorId").value(0L)) .andExpect(jsonPath("$.data.items[0].nickname").value("")) - .andExpect(jsonPath("$.data.items[0].profileImageUrl").value("/profile/default-profile.png")) + .andExpect(jsonPath("$.data.items[0].profileImageUrl").value("https://cdn.test/profile/default-profile.png")) } private fun saveMember(seed: String, role: MemberRole): Member { diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryServiceTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryServiceTest.kt index b5f34d29..703f3d30 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryServiceTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/ranking/application/CreatorRankingQueryServiceTest.kt @@ -266,7 +266,7 @@ class CreatorRankingQueryServiceTest { assertNull(blockPort.memberId) assertEquals(1L, result.items.single().creatorId) assertEquals("creator-1", result.items.single().nickname) - assertEquals("profile-1.png", result.items.single().profileImageUrl) + assertEquals("https://cdn.test/profile-1.png", result.items.single().profileImageUrl) } @Test