feat(creator-channel): 홈 조회 언어를 전달한다

This commit is contained in:
2026-09-09 23:16:45 +09:00
parent 6688bd7117
commit 950ff98e18
3 changed files with 62 additions and 18 deletions
@@ -101,6 +101,25 @@ class CreatorChannelHomeQueryServiceTest {
assertEquals(false, port.currentLiveCanViewAdultContent)
assertEquals(false, port.schedulesCanViewAdultContent)
assertEquals(201L, port.audioContentsLatestAudioContentId)
assertEquals("ko", port.latestAudioLocale)
assertEquals("ko", port.audioContentsLocale)
assertEquals("ko", port.schedulesLocale)
assertEquals("ko", port.seriesLocale)
}
@Test
@DisplayName("홈 서비스는 요청 locale을 오디오, 스케줄, 시리즈 조회에 전달한다")
fun shouldPassLocaleToHomeQueries() {
val port = FakeCreatorChannelHomeQueryPort()
val service = createService(port, lang = Lang.JA)
val viewer = createMember(id = 10L)
service.getHome(creatorId = 1L, viewer = viewer, now = LocalDateTime.of(2026, 6, 13, 10, 0))
assertEquals("ja", port.latestAudioLocale)
assertEquals("ja", port.audioContentsLocale)
assertEquals("ja", port.schedulesLocale)
assertEquals("ja", port.seriesLocale)
}
@Test
@@ -468,11 +487,12 @@ class CreatorChannelHomeQueryServiceTest {
port: FakeCreatorChannelHomeQueryPort,
communityPort: FakeCreatorChannelCommunityQueryPort = FakeCreatorChannelCommunityQueryPort(),
canViewAdultContent: Boolean = true,
preferenceService: MemberContentPreferenceService = createPreferenceService(canViewAdultContent)
preferenceService: MemberContentPreferenceService = createPreferenceService(canViewAdultContent),
lang: Lang = Lang.KO
): CreatorChannelHomeQueryService {
val messageSource = SodaMessageSource()
val langContext = LangContext()
langContext.setLang(Lang.KO)
langContext.setLang(lang)
val audioContentCloudFront = Mockito.mock(AudioContentCloudFront::class.java)
Mockito.`when`(audioContentCloudFront.generateSignedURL(Mockito.anyString(), Mockito.anyLong()))
.thenAnswer { invocation -> "https://signed.test/${invocation.getArgument<String>(0)}" }
@@ -565,6 +585,10 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
var schedulesEffectiveViewerGender: Gender? = null
var schedulesCanViewAdultContent: Boolean? = null
var audioContentsLatestAudioContentId: Long? = null
var latestAudioLocale: String? = null
var schedulesLocale: String? = null
var audioContentsLocale: String? = null
var seriesLocale: String? = null
var channelDonationNickname: String = "fan"
override fun findCreator(creatorId: Long, viewerId: Long?): CreatorChannelCreatorRecord? = creator
@@ -597,8 +621,12 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
creatorId: Long,
now: LocalDateTime,
canViewAdultContent: Boolean,
viewerId: Long?
): CreatorChannelAudioContentRecord? = audioContentRecord(201L, "audio/latest.png")
viewerId: Long?,
locale: String
): CreatorChannelAudioContentRecord? {
latestAudioLocale = locale
return audioContentRecord(201L, "audio/latest.png")
}
override fun findChannelDonations(
creatorId: Long,
@@ -622,12 +650,14 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
viewerId: Long?,
isViewerCreator: Boolean,
effectiveViewerGender: Gender?,
locale: String,
limit: Int
): List<CreatorChannelScheduleRecord> {
schedulesViewerId = viewerId
schedulesIsViewerCreator = isViewerCreator
schedulesEffectiveViewerGender = effectiveViewerGender
schedulesCanViewAdultContent = canViewAdultContent
schedulesLocale = locale
return listOf(
scheduleRecord(401L, LocalDateTime.of(2026, 6, 13, 12, 0), CreatorActivityType.AUDIO, false),
scheduleRecord(402L, LocalDateTime.of(2026, 6, 13, 12, 0), CreatorActivityType.LIVE, false),
@@ -644,9 +674,11 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
latestAudioContentId: Long?,
canViewAdultContent: Boolean,
viewerId: Long?,
locale: String,
limit: Int
): List<CreatorChannelAudioContentRecord> {
audioContentsLatestAudioContentId = latestAudioContentId
audioContentsLocale = locale
return listOf(
audioContentRecord(201L, "audio/latest.png"),
audioContentRecord(203L, "audio/203.png"),
@@ -660,17 +692,21 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
now: LocalDateTime,
canViewAdultContent: Boolean,
contentType: ContentType,
locale: String,
limit: Int
): List<CreatorChannelSeriesRecord> = listOf(
CreatorChannelSeriesRecord(
seriesId = 501L,
title = "series",
coverImagePath = "series.png",
numberOfContent = 2,
isNew = true,
isOriginal = false
): List<CreatorChannelSeriesRecord> {
seriesLocale = locale
return listOf(
CreatorChannelSeriesRecord(
seriesId = 501L,
title = "series",
coverImagePath = "series.png",
numberOfContent = 2,
isNew = true,
isOriginal = false
)
)
)
}
override fun findFanTalkSummary(creatorId: Long, viewerId: Long?): CreatorChannelFanTalkSummaryRecord {
return CreatorChannelFanTalkSummaryRecord(