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