feat(home-recommendation): 첫 오디오 제목 번역을 적용한다
This commit is contained in:
+19
-3
@@ -15,6 +15,7 @@ import kr.co.vividnext.sodalive.chat.room.QChatMessage.chatMessage
|
||||
import kr.co.vividnext.sodalive.chat.room.QChatParticipant.chatParticipant
|
||||
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerType
|
||||
import kr.co.vividnext.sodalive.content.main.banner.QAudioContentBanner.audioContentBanner
|
||||
import kr.co.vividnext.sodalive.content.translation.ContentTranslationRepository
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeries.series
|
||||
import kr.co.vividnext.sodalive.event.QEvent.event
|
||||
import kr.co.vividnext.sodalive.explorer.profile.creatorCommunity.QCreatorCommunity.creatorCommunity
|
||||
@@ -50,7 +51,8 @@ import javax.persistence.EntityManager
|
||||
@Repository
|
||||
class DefaultHomeRecommendationQueryRepository(
|
||||
private val queryFactory: JPAQueryFactory,
|
||||
private val entityManager: EntityManager
|
||||
private val entityManager: EntityManager,
|
||||
private val contentTranslationRepository: ContentTranslationRepository
|
||||
) : HomeRecommendationQueryRepository {
|
||||
override fun findLiveRecommendations(
|
||||
offset: Long,
|
||||
@@ -367,7 +369,8 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
offset: Long,
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
includeAdultContents: Boolean
|
||||
includeAdultContents: Boolean,
|
||||
locale: String
|
||||
): List<HomeFirstAudioContentRecord> {
|
||||
val sql = """
|
||||
with creator_debut as (
|
||||
@@ -475,7 +478,7 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val rows = query.resultList as List<Array<Any?>>
|
||||
|
||||
return rows.map { row ->
|
||||
val firstAudioContents = rows.map { row ->
|
||||
HomeFirstAudioContentRecord(
|
||||
contentId = (row[0] as Number).toLong(),
|
||||
creatorId = (row[1] as Number).toLong(),
|
||||
@@ -489,6 +492,19 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
isOriginalSeries = row[9].toNativeBoolean()
|
||||
)
|
||||
}
|
||||
if (firstAudioContents.isEmpty()) return emptyList()
|
||||
|
||||
val translatedTitleByContentId = contentTranslationRepository
|
||||
.findByContentIdInAndLocale(firstAudioContents.map { it.contentId }, locale)
|
||||
.mapNotNull { translation ->
|
||||
translation.renderedPayload.title
|
||||
.takeIf { it.isNotBlank() }
|
||||
?.let { translation.contentId to it }
|
||||
}
|
||||
.toMap()
|
||||
return firstAudioContents.map { audio ->
|
||||
translatedTitleByContentId[audio.contentId]?.let { audio.copy(title = it) } ?: audio
|
||||
}
|
||||
}
|
||||
|
||||
override fun findAiCharacterSnapshots(
|
||||
|
||||
Reference in New Issue
Block a user