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
@@ -73,8 +73,9 @@ class CreatorChannelHomeQueryService(
val canViewAdultContent = preference.isAdult
val isViewerCreator = viewer.role == MemberRole.CREATOR
val effectiveViewerGender = viewer.effectiveGender()
val locale = langContext.lang.code
val latestAudioContent = queryPort
.findLatestAudioContent(creatorId, now, canViewAdultContent, viewerId)
.findLatestAudioContent(creatorId, now, canViewAdultContent, viewerId, locale)
?.toDomain()
val audioContents = queryPolicy.excludeLatestAudioContent(
queryPort.findAudioContents(
@@ -82,7 +83,8 @@ class CreatorChannelHomeQueryService(
now = now,
latestAudioContentId = latestAudioContent?.audioContentId,
canViewAdultContent = canViewAdultContent,
viewerId = viewerId
viewerId = viewerId,
locale = locale
).map { it.toDomain() },
latestAudioContent?.audioContentId
)
@@ -113,7 +115,8 @@ class CreatorChannelHomeQueryService(
canViewAdultContent = canViewAdultContent,
viewerId = viewerId,
isViewerCreator = isViewerCreator,
effectiveViewerGender = effectiveViewerGender
effectiveViewerGender = effectiveViewerGender,
locale = locale
).map { it.toDomain() },
now,
canViewAdultContent
@@ -124,7 +127,8 @@ class CreatorChannelHomeQueryService(
viewerId = viewerId,
now = now,
canViewAdultContent = canViewAdultContent,
contentType = preference.contentType
contentType = preference.contentType,
locale = locale
).map { it.toDomain() },
communities = communityQueryService.findHomeCommunityPosts(
creatorId = creatorId,
@@ -24,7 +24,8 @@ interface CreatorChannelHomeQueryPort {
creatorId: Long,
now: LocalDateTime,
canViewAdultContent: Boolean,
viewerId: Long? = null
viewerId: Long? = null,
locale: String = "ko"
): CreatorChannelAudioContentRecord?
fun findChannelDonations(
@@ -41,6 +42,7 @@ interface CreatorChannelHomeQueryPort {
viewerId: Long?,
isViewerCreator: Boolean,
effectiveViewerGender: Gender?,
locale: String = "ko",
limit: Int = 3
): List<CreatorChannelScheduleRecord>
@@ -50,6 +52,7 @@ interface CreatorChannelHomeQueryPort {
latestAudioContentId: Long?,
canViewAdultContent: Boolean,
viewerId: Long? = null,
locale: String = "ko",
limit: Int = 9
): List<CreatorChannelAudioContentRecord>
@@ -59,6 +62,7 @@ interface CreatorChannelHomeQueryPort {
now: LocalDateTime,
canViewAdultContent: Boolean,
contentType: ContentType,
locale: String = "ko",
limit: Int = 8
): List<CreatorChannelSeriesRecord>
@@ -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,8 +692,11 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
now: LocalDateTime,
canViewAdultContent: Boolean,
contentType: ContentType,
locale: String,
limit: Int
): List<CreatorChannelSeriesRecord> = listOf(
): List<CreatorChannelSeriesRecord> {
seriesLocale = locale
return listOf(
CreatorChannelSeriesRecord(
seriesId = 501L,
title = "series",
@@ -671,6 +706,7 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
isOriginal = false
)
)
}
override fun findFanTalkSummary(creatorId: Long, viewerId: Long?): CreatorChannelFanTalkSummaryRecord {
return CreatorChannelFanTalkSummaryRecord(