크리에이터 채널 - languageCode에 따라 콘텐츠 번역 데이터 조회
This commit is contained in:
@@ -52,6 +52,7 @@ class ExplorerController(private val service: ExplorerService) {
|
|||||||
fun getCreatorProfile(
|
fun getCreatorProfile(
|
||||||
@PathVariable("id") creatorId: Long,
|
@PathVariable("id") creatorId: Long,
|
||||||
@RequestParam timezone: String,
|
@RequestParam timezone: String,
|
||||||
|
@RequestParam("languageCode", required = false) languageCode: String? = null,
|
||||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
@@ -60,6 +61,7 @@ class ExplorerController(private val service: ExplorerService) {
|
|||||||
service.getCreatorProfile(
|
service.getCreatorProfile(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
timezone = timezone,
|
timezone = timezone,
|
||||||
|
languageCode = languageCode,
|
||||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||||
member = member
|
member = member
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.content.LanguageDetectEvent
|
|||||||
import kr.co.vividnext.sodalive.content.LanguageDetectTargetType
|
import kr.co.vividnext.sodalive.content.LanguageDetectTargetType
|
||||||
import kr.co.vividnext.sodalive.content.SortType
|
import kr.co.vividnext.sodalive.content.SortType
|
||||||
import kr.co.vividnext.sodalive.content.series.ContentSeriesService
|
import kr.co.vividnext.sodalive.content.series.ContentSeriesService
|
||||||
|
import kr.co.vividnext.sodalive.content.translation.ContentTranslationRepository
|
||||||
import kr.co.vividnext.sodalive.explorer.follower.GetFollowerListResponse
|
import kr.co.vividnext.sodalive.explorer.follower.GetFollowerListResponse
|
||||||
import kr.co.vividnext.sodalive.explorer.follower.GetFollowerListResponseItem
|
import kr.co.vividnext.sodalive.explorer.follower.GetFollowerListResponseItem
|
||||||
import kr.co.vividnext.sodalive.explorer.profile.ChannelNotice
|
import kr.co.vividnext.sodalive.explorer.profile.ChannelNotice
|
||||||
@@ -46,6 +47,7 @@ class ExplorerService(
|
|||||||
private val seriesService: ContentSeriesService,
|
private val seriesService: ContentSeriesService,
|
||||||
|
|
||||||
private val applicationEventPublisher: ApplicationEventPublisher,
|
private val applicationEventPublisher: ApplicationEventPublisher,
|
||||||
|
private val contentTranslationRepository: ContentTranslationRepository,
|
||||||
|
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
@Value("\${cloud.aws.cloud-front.host}")
|
||||||
private val cloudFrontHost: String
|
private val cloudFrontHost: String
|
||||||
@@ -170,6 +172,7 @@ class ExplorerService(
|
|||||||
fun getCreatorProfile(
|
fun getCreatorProfile(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
timezone: String,
|
timezone: String,
|
||||||
|
languageCode: String?,
|
||||||
isAdultContentVisible: Boolean,
|
isAdultContentVisible: Boolean,
|
||||||
member: Member
|
member: Member
|
||||||
): GetCreatorProfileResponse {
|
): GetCreatorProfileResponse {
|
||||||
@@ -233,6 +236,29 @@ class ExplorerService(
|
|||||||
listOf()
|
listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val translatedContentList = if (!languageCode.isNullOrBlank() && contentList.isNotEmpty()) {
|
||||||
|
val contentIds = contentList.map { it.contentId }
|
||||||
|
|
||||||
|
if (contentIds.isNotEmpty()) {
|
||||||
|
val translations = contentTranslationRepository
|
||||||
|
.findByContentIdInAndLocale(contentIds = contentIds, locale = languageCode)
|
||||||
|
.associateBy { it.contentId }
|
||||||
|
|
||||||
|
contentList.map { item ->
|
||||||
|
val translatedTitle = translations[item.contentId]?.renderedPayload?.title
|
||||||
|
if (translatedTitle.isNullOrBlank()) {
|
||||||
|
item
|
||||||
|
} else {
|
||||||
|
item.copy(title = translatedTitle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contentList
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contentList
|
||||||
|
}
|
||||||
|
|
||||||
// 크리에이터의 최신 오디오 콘텐츠 1개
|
// 크리에이터의 최신 오디오 콘텐츠 1개
|
||||||
val latestContent = if (isCreator) {
|
val latestContent = if (isCreator) {
|
||||||
audioContentService.getLatestCreatorAudioContent(creatorId, member, isAdultContentVisible)
|
audioContentService.getLatestCreatorAudioContent(creatorId, member, isAdultContentVisible)
|
||||||
@@ -333,7 +359,7 @@ class ExplorerService(
|
|||||||
userDonationRanking = memberDonationRanking,
|
userDonationRanking = memberDonationRanking,
|
||||||
similarCreatorList = similarCreatorList,
|
similarCreatorList = similarCreatorList,
|
||||||
liveRoomList = liveRoomList,
|
liveRoomList = liveRoomList,
|
||||||
contentList = contentList,
|
contentList = translatedContentList,
|
||||||
latestContent = latestContent,
|
latestContent = latestContent,
|
||||||
totalContentCount = totalContentCount,
|
totalContentCount = totalContentCount,
|
||||||
ownedContentCount = ownedContentCount,
|
ownedContentCount = ownedContentCount,
|
||||||
|
|||||||
Reference in New Issue
Block a user