feat(audio-recommendation): 추천 조회 언어를 전달한다
This commit is contained in:
+15
-8
@@ -1,6 +1,7 @@
|
||||
package kr.co.vividnext.sodalive.v2.content.recommendation.application
|
||||
|
||||
import kr.co.vividnext.sodalive.i18n.Lang
|
||||
import kr.co.vividnext.sodalive.i18n.LangContext
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||
import kr.co.vividnext.sodalive.v2.content.recommendation.domain.AudioCard
|
||||
@@ -17,7 +18,8 @@ import java.time.ZoneId
|
||||
class AudioRecommendationQueryService(
|
||||
private val queryPort: AudioRecommendationQueryPort,
|
||||
private val memberContentPreferenceService: MemberContentPreferenceService,
|
||||
private val snapshotFallbackService: AudioRecommendationSnapshotFallbackService
|
||||
private val snapshotFallbackService: AudioRecommendationSnapshotFallbackService,
|
||||
private val langContext: LangContext
|
||||
) {
|
||||
fun getRecommendations(member: Member?): AudioRecommendations {
|
||||
val now = LocalDateTime.now()
|
||||
@@ -25,6 +27,7 @@ class AudioRecommendationQueryService(
|
||||
val canViewAdultContent = canViewAdultContent(member)
|
||||
val visibility = if (canViewAdultContent) AudioRecommendationVisibility.ALL else AudioRecommendationVisibility.SAFE
|
||||
val memberId = member?.id
|
||||
val locale = langContext.lang.code
|
||||
val bannerLang = if (memberContentPreferenceService.resolveCountryCode(member) == "JP") Lang.JA else Lang.KO
|
||||
val newAndHotSectionType = newAndHotSectionType(visibility)
|
||||
val mostCommentedSectionType = mostCommentedSectionType(visibility)
|
||||
@@ -48,25 +51,28 @@ class AudioRecommendationQueryService(
|
||||
return AudioRecommendations(
|
||||
banners = queryPort.findBanners(BANNER_LIMIT, memberId, canViewAdultContent, bannerLang),
|
||||
originalSeries = queryPort.findOriginalSeries(ORIGINAL_SERIES_LIMIT, memberId, canViewAdultContent, now),
|
||||
latestAudios = queryPort.findLatestAudios(LATEST_AUDIO_LIMIT, memberId, canViewAdultContent, now),
|
||||
latestAudios = queryPort.findLatestAudios(LATEST_AUDIO_LIMIT, memberId, canViewAdultContent, now, locale),
|
||||
newAndHotAudios = queryPort.findAudioCardsByIds(
|
||||
newAndHotSnapshots.map { it.targetId },
|
||||
memberId,
|
||||
canViewAdultContent,
|
||||
now
|
||||
now,
|
||||
locale
|
||||
),
|
||||
freeAudios = queryPort.findFreeAudios(FREE_AUDIO_LIMIT, memberId, canViewAdultContent, now),
|
||||
pointAudios = queryPort.findPointAudios(POINT_AUDIO_LIMIT, memberId, canViewAdultContent, now),
|
||||
freeAudios = queryPort.findFreeAudios(FREE_AUDIO_LIMIT, memberId, canViewAdultContent, now, locale),
|
||||
pointAudios = queryPort.findPointAudios(POINT_AUDIO_LIMIT, memberId, canViewAdultContent, now, locale),
|
||||
mostCommentedAudios = queryPort.findCommentedAudiosByIds(
|
||||
mostCommentedSnapshots.map { it.targetId },
|
||||
memberId,
|
||||
canViewAdultContent
|
||||
canViewAdultContent,
|
||||
locale
|
||||
),
|
||||
recommendedAudios = queryPort.findAudioCardsByIds(
|
||||
recommendedSnapshots.map { it.targetId },
|
||||
memberId,
|
||||
canViewAdultContent,
|
||||
now
|
||||
now,
|
||||
locale
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -83,7 +89,8 @@ class AudioRecommendationQueryService(
|
||||
snapshots.map { it.targetId },
|
||||
member.id,
|
||||
canViewAdultContent,
|
||||
now
|
||||
now,
|
||||
langContext.lang.code
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+29
-5
@@ -17,16 +17,40 @@ interface AudioRecommendationQueryPort {
|
||||
lang: Lang = Lang.KO
|
||||
): List<RecommendationBanner>
|
||||
fun findOriginalSeries(limit: Int, memberId: Long?, canViewAdultContent: Boolean, now: LocalDateTime): List<OriginalSeries>
|
||||
fun findLatestAudios(limit: Int, memberId: Long?, canViewAdultContent: Boolean, now: LocalDateTime): List<AudioCard>
|
||||
fun findFreeAudios(limit: Int, memberId: Long?, canViewAdultContent: Boolean, now: LocalDateTime): List<AudioCard>
|
||||
fun findPointAudios(limit: Int, memberId: Long?, canViewAdultContent: Boolean, now: LocalDateTime): List<AudioCard>
|
||||
fun findLatestAudios(
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
canViewAdultContent: Boolean,
|
||||
now: LocalDateTime,
|
||||
locale: String
|
||||
): List<AudioCard>
|
||||
fun findFreeAudios(
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
canViewAdultContent: Boolean,
|
||||
now: LocalDateTime,
|
||||
locale: String
|
||||
): List<AudioCard>
|
||||
fun findPointAudios(
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
canViewAdultContent: Boolean,
|
||||
now: LocalDateTime,
|
||||
locale: String
|
||||
): List<AudioCard>
|
||||
fun findAudioCardsByIds(
|
||||
contentIds: List<Long>,
|
||||
memberId: Long?,
|
||||
canViewAdultContent: Boolean,
|
||||
now: LocalDateTime
|
||||
now: LocalDateTime,
|
||||
locale: String
|
||||
): List<AudioCard>
|
||||
fun findCommentedAudiosByIds(contentIds: List<Long>, memberId: Long?, canViewAdultContent: Boolean): List<CommentedAudio>
|
||||
fun findCommentedAudiosByIds(
|
||||
contentIds: List<Long>,
|
||||
memberId: Long?,
|
||||
canViewAdultContent: Boolean,
|
||||
locale: String
|
||||
): List<CommentedAudio>
|
||||
fun findNewAndHotSnapshots(
|
||||
windowStart: LocalDateTime,
|
||||
snapshotAt: LocalDateTime,
|
||||
|
||||
Reference in New Issue
Block a user