fix(ranking): 프로필 이미지 CDN URL을 반환한다
This commit is contained in:
@@ -143,10 +143,14 @@ class CreatorRankingQueryService(
|
|||||||
isNew = false,
|
isNew = false,
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
nickname = nickname,
|
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 {
|
private fun CreatorRankingSnapshotCandidate.toSnapshotRecord(utcRange: CreatorRankingUtcRange): CreatorRankingSnapshotRecord {
|
||||||
val calculatedContentLiveScore = scorePolicy.calculateContentLiveScore(
|
val calculatedContentLiveScore = scorePolicy.calculateContentLiveScore(
|
||||||
liveCanAmount = liveCanAmount,
|
liveCanAmount = liveCanAmount,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.Transactional
|
|||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import javax.persistence.EntityManager
|
import javax.persistence.EntityManager
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest(properties = ["cloud.aws.cloud-front.host=https://cdn.test"])
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@Transactional
|
@Transactional
|
||||||
@ContextConfiguration(initializers = [EmbeddedRedisInitializer::class])
|
@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].isNew").value(false))
|
||||||
.andExpect(jsonPath("$.data.items[0].creatorId").value(1L))
|
.andExpect(jsonPath("$.data.items[0].creatorId").value(1L))
|
||||||
.andExpect(jsonPath("$.data.items[0].nickname").value("creator-one"))
|
.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].finalScore").doesNotExist())
|
||||||
.andExpect(jsonPath("$.data.items[0].aggregationStartAtUtc").doesNotExist())
|
.andExpect(jsonPath("$.data.items[0].aggregationStartAtUtc").doesNotExist())
|
||||||
.andExpect(jsonPath("$.data.items[0].aggregationEndAtUtc").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].rank").value(1))
|
||||||
.andExpect(jsonPath("$.data.items[0].creatorId").value(0L))
|
.andExpect(jsonPath("$.data.items[0].creatorId").value(0L))
|
||||||
.andExpect(jsonPath("$.data.items[0].nickname").value(""))
|
.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 {
|
private fun saveMember(seed: String, role: MemberRole): Member {
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class CreatorRankingQueryServiceTest {
|
|||||||
assertNull(blockPort.memberId)
|
assertNull(blockPort.memberId)
|
||||||
assertEquals(1L, result.items.single().creatorId)
|
assertEquals(1L, result.items.single().creatorId)
|
||||||
assertEquals("creator-1", result.items.single().nickname)
|
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
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user