feat(creator-channel): 홈 조회 언어를 전달한다
This commit is contained in:
+8
-4
@@ -73,8 +73,9 @@ class CreatorChannelHomeQueryService(
|
|||||||
val canViewAdultContent = preference.isAdult
|
val canViewAdultContent = preference.isAdult
|
||||||
val isViewerCreator = viewer.role == MemberRole.CREATOR
|
val isViewerCreator = viewer.role == MemberRole.CREATOR
|
||||||
val effectiveViewerGender = viewer.effectiveGender()
|
val effectiveViewerGender = viewer.effectiveGender()
|
||||||
|
val locale = langContext.lang.code
|
||||||
val latestAudioContent = queryPort
|
val latestAudioContent = queryPort
|
||||||
.findLatestAudioContent(creatorId, now, canViewAdultContent, viewerId)
|
.findLatestAudioContent(creatorId, now, canViewAdultContent, viewerId, locale)
|
||||||
?.toDomain()
|
?.toDomain()
|
||||||
val audioContents = queryPolicy.excludeLatestAudioContent(
|
val audioContents = queryPolicy.excludeLatestAudioContent(
|
||||||
queryPort.findAudioContents(
|
queryPort.findAudioContents(
|
||||||
@@ -82,7 +83,8 @@ class CreatorChannelHomeQueryService(
|
|||||||
now = now,
|
now = now,
|
||||||
latestAudioContentId = latestAudioContent?.audioContentId,
|
latestAudioContentId = latestAudioContent?.audioContentId,
|
||||||
canViewAdultContent = canViewAdultContent,
|
canViewAdultContent = canViewAdultContent,
|
||||||
viewerId = viewerId
|
viewerId = viewerId,
|
||||||
|
locale = locale
|
||||||
).map { it.toDomain() },
|
).map { it.toDomain() },
|
||||||
latestAudioContent?.audioContentId
|
latestAudioContent?.audioContentId
|
||||||
)
|
)
|
||||||
@@ -113,7 +115,8 @@ class CreatorChannelHomeQueryService(
|
|||||||
canViewAdultContent = canViewAdultContent,
|
canViewAdultContent = canViewAdultContent,
|
||||||
viewerId = viewerId,
|
viewerId = viewerId,
|
||||||
isViewerCreator = isViewerCreator,
|
isViewerCreator = isViewerCreator,
|
||||||
effectiveViewerGender = effectiveViewerGender
|
effectiveViewerGender = effectiveViewerGender,
|
||||||
|
locale = locale
|
||||||
).map { it.toDomain() },
|
).map { it.toDomain() },
|
||||||
now,
|
now,
|
||||||
canViewAdultContent
|
canViewAdultContent
|
||||||
@@ -124,7 +127,8 @@ class CreatorChannelHomeQueryService(
|
|||||||
viewerId = viewerId,
|
viewerId = viewerId,
|
||||||
now = now,
|
now = now,
|
||||||
canViewAdultContent = canViewAdultContent,
|
canViewAdultContent = canViewAdultContent,
|
||||||
contentType = preference.contentType
|
contentType = preference.contentType,
|
||||||
|
locale = locale
|
||||||
).map { it.toDomain() },
|
).map { it.toDomain() },
|
||||||
communities = communityQueryService.findHomeCommunityPosts(
|
communities = communityQueryService.findHomeCommunityPosts(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
|
|||||||
+5
-1
@@ -24,7 +24,8 @@ interface CreatorChannelHomeQueryPort {
|
|||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
canViewAdultContent: Boolean,
|
canViewAdultContent: Boolean,
|
||||||
viewerId: Long? = null
|
viewerId: Long? = null,
|
||||||
|
locale: String = "ko"
|
||||||
): CreatorChannelAudioContentRecord?
|
): CreatorChannelAudioContentRecord?
|
||||||
|
|
||||||
fun findChannelDonations(
|
fun findChannelDonations(
|
||||||
@@ -41,6 +42,7 @@ interface CreatorChannelHomeQueryPort {
|
|||||||
viewerId: Long?,
|
viewerId: Long?,
|
||||||
isViewerCreator: Boolean,
|
isViewerCreator: Boolean,
|
||||||
effectiveViewerGender: Gender?,
|
effectiveViewerGender: Gender?,
|
||||||
|
locale: String = "ko",
|
||||||
limit: Int = 3
|
limit: Int = 3
|
||||||
): List<CreatorChannelScheduleRecord>
|
): List<CreatorChannelScheduleRecord>
|
||||||
|
|
||||||
@@ -50,6 +52,7 @@ interface CreatorChannelHomeQueryPort {
|
|||||||
latestAudioContentId: Long?,
|
latestAudioContentId: Long?,
|
||||||
canViewAdultContent: Boolean,
|
canViewAdultContent: Boolean,
|
||||||
viewerId: Long? = null,
|
viewerId: Long? = null,
|
||||||
|
locale: String = "ko",
|
||||||
limit: Int = 9
|
limit: Int = 9
|
||||||
): List<CreatorChannelAudioContentRecord>
|
): List<CreatorChannelAudioContentRecord>
|
||||||
|
|
||||||
@@ -59,6 +62,7 @@ interface CreatorChannelHomeQueryPort {
|
|||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
canViewAdultContent: Boolean,
|
canViewAdultContent: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
|
locale: String = "ko",
|
||||||
limit: Int = 8
|
limit: Int = 8
|
||||||
): List<CreatorChannelSeriesRecord>
|
): List<CreatorChannelSeriesRecord>
|
||||||
|
|
||||||
|
|||||||
+49
-13
@@ -101,6 +101,25 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
assertEquals(false, port.currentLiveCanViewAdultContent)
|
assertEquals(false, port.currentLiveCanViewAdultContent)
|
||||||
assertEquals(false, port.schedulesCanViewAdultContent)
|
assertEquals(false, port.schedulesCanViewAdultContent)
|
||||||
assertEquals(201L, port.audioContentsLatestAudioContentId)
|
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
|
@Test
|
||||||
@@ -468,11 +487,12 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
port: FakeCreatorChannelHomeQueryPort,
|
port: FakeCreatorChannelHomeQueryPort,
|
||||||
communityPort: FakeCreatorChannelCommunityQueryPort = FakeCreatorChannelCommunityQueryPort(),
|
communityPort: FakeCreatorChannelCommunityQueryPort = FakeCreatorChannelCommunityQueryPort(),
|
||||||
canViewAdultContent: Boolean = true,
|
canViewAdultContent: Boolean = true,
|
||||||
preferenceService: MemberContentPreferenceService = createPreferenceService(canViewAdultContent)
|
preferenceService: MemberContentPreferenceService = createPreferenceService(canViewAdultContent),
|
||||||
|
lang: Lang = Lang.KO
|
||||||
): CreatorChannelHomeQueryService {
|
): CreatorChannelHomeQueryService {
|
||||||
val messageSource = SodaMessageSource()
|
val messageSource = SodaMessageSource()
|
||||||
val langContext = LangContext()
|
val langContext = LangContext()
|
||||||
langContext.setLang(Lang.KO)
|
langContext.setLang(lang)
|
||||||
val audioContentCloudFront = Mockito.mock(AudioContentCloudFront::class.java)
|
val audioContentCloudFront = Mockito.mock(AudioContentCloudFront::class.java)
|
||||||
Mockito.`when`(audioContentCloudFront.generateSignedURL(Mockito.anyString(), Mockito.anyLong()))
|
Mockito.`when`(audioContentCloudFront.generateSignedURL(Mockito.anyString(), Mockito.anyLong()))
|
||||||
.thenAnswer { invocation -> "https://signed.test/${invocation.getArgument<String>(0)}" }
|
.thenAnswer { invocation -> "https://signed.test/${invocation.getArgument<String>(0)}" }
|
||||||
@@ -565,6 +585,10 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
var schedulesEffectiveViewerGender: Gender? = null
|
var schedulesEffectiveViewerGender: Gender? = null
|
||||||
var schedulesCanViewAdultContent: Boolean? = null
|
var schedulesCanViewAdultContent: Boolean? = null
|
||||||
var audioContentsLatestAudioContentId: Long? = 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"
|
var channelDonationNickname: String = "fan"
|
||||||
|
|
||||||
override fun findCreator(creatorId: Long, viewerId: Long?): CreatorChannelCreatorRecord? = creator
|
override fun findCreator(creatorId: Long, viewerId: Long?): CreatorChannelCreatorRecord? = creator
|
||||||
@@ -597,8 +621,12 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
canViewAdultContent: Boolean,
|
canViewAdultContent: Boolean,
|
||||||
viewerId: Long?
|
viewerId: Long?,
|
||||||
): CreatorChannelAudioContentRecord? = audioContentRecord(201L, "audio/latest.png")
|
locale: String
|
||||||
|
): CreatorChannelAudioContentRecord? {
|
||||||
|
latestAudioLocale = locale
|
||||||
|
return audioContentRecord(201L, "audio/latest.png")
|
||||||
|
}
|
||||||
|
|
||||||
override fun findChannelDonations(
|
override fun findChannelDonations(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
@@ -622,12 +650,14 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
viewerId: Long?,
|
viewerId: Long?,
|
||||||
isViewerCreator: Boolean,
|
isViewerCreator: Boolean,
|
||||||
effectiveViewerGender: Gender?,
|
effectiveViewerGender: Gender?,
|
||||||
|
locale: String,
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<CreatorChannelScheduleRecord> {
|
): List<CreatorChannelScheduleRecord> {
|
||||||
schedulesViewerId = viewerId
|
schedulesViewerId = viewerId
|
||||||
schedulesIsViewerCreator = isViewerCreator
|
schedulesIsViewerCreator = isViewerCreator
|
||||||
schedulesEffectiveViewerGender = effectiveViewerGender
|
schedulesEffectiveViewerGender = effectiveViewerGender
|
||||||
schedulesCanViewAdultContent = canViewAdultContent
|
schedulesCanViewAdultContent = canViewAdultContent
|
||||||
|
schedulesLocale = locale
|
||||||
return listOf(
|
return listOf(
|
||||||
scheduleRecord(401L, LocalDateTime.of(2026, 6, 13, 12, 0), CreatorActivityType.AUDIO, false),
|
scheduleRecord(401L, LocalDateTime.of(2026, 6, 13, 12, 0), CreatorActivityType.AUDIO, false),
|
||||||
scheduleRecord(402L, LocalDateTime.of(2026, 6, 13, 12, 0), CreatorActivityType.LIVE, false),
|
scheduleRecord(402L, LocalDateTime.of(2026, 6, 13, 12, 0), CreatorActivityType.LIVE, false),
|
||||||
@@ -644,9 +674,11 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
latestAudioContentId: Long?,
|
latestAudioContentId: Long?,
|
||||||
canViewAdultContent: Boolean,
|
canViewAdultContent: Boolean,
|
||||||
viewerId: Long?,
|
viewerId: Long?,
|
||||||
|
locale: String,
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<CreatorChannelAudioContentRecord> {
|
): List<CreatorChannelAudioContentRecord> {
|
||||||
audioContentsLatestAudioContentId = latestAudioContentId
|
audioContentsLatestAudioContentId = latestAudioContentId
|
||||||
|
audioContentsLocale = locale
|
||||||
return listOf(
|
return listOf(
|
||||||
audioContentRecord(201L, "audio/latest.png"),
|
audioContentRecord(201L, "audio/latest.png"),
|
||||||
audioContentRecord(203L, "audio/203.png"),
|
audioContentRecord(203L, "audio/203.png"),
|
||||||
@@ -660,17 +692,21 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
canViewAdultContent: Boolean,
|
canViewAdultContent: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
|
locale: String,
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<CreatorChannelSeriesRecord> = listOf(
|
): List<CreatorChannelSeriesRecord> {
|
||||||
CreatorChannelSeriesRecord(
|
seriesLocale = locale
|
||||||
seriesId = 501L,
|
return listOf(
|
||||||
title = "series",
|
CreatorChannelSeriesRecord(
|
||||||
coverImagePath = "series.png",
|
seriesId = 501L,
|
||||||
numberOfContent = 2,
|
title = "series",
|
||||||
isNew = true,
|
coverImagePath = "series.png",
|
||||||
isOriginal = false
|
numberOfContent = 2,
|
||||||
|
isNew = true,
|
||||||
|
isOriginal = false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
override fun findFanTalkSummary(creatorId: Long, viewerId: Long?): CreatorChannelFanTalkSummaryRecord {
|
override fun findFanTalkSummary(creatorId: Long, viewerId: Long?): CreatorChannelFanTalkSummaryRecord {
|
||||||
return CreatorChannelFanTalkSummaryRecord(
|
return CreatorChannelFanTalkSummaryRecord(
|
||||||
|
|||||||
Reference in New Issue
Block a user