feat(home-following): 커뮤니티 소식 본문 번역을 적용한다

This commit is contained in:
2026-09-10 15:14:35 +09:00
parent 02fceca353
commit 0d44258a61
3 changed files with 143 additions and 4 deletions
@@ -1,9 +1,12 @@
package kr.co.vividnext.sodalive.v2.home.following.application
import kr.co.vividnext.sodalive.i18n.LangContext
import kr.co.vividnext.sodalive.member.Gender
import kr.co.vividnext.sodalive.member.Member
import kr.co.vividnext.sodalive.member.MemberRole
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
import kr.co.vividnext.sodalive.v2.creator.channel.community.translation.application.CreatorCommunityTranslationService
import kr.co.vividnext.sodalive.v2.home.following.domain.FollowingNewsType
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowing
import kr.co.vividnext.sodalive.v2.home.following.port.out.HomeFollowingQueryPort
import org.springframework.stereotype.Service
@@ -16,6 +19,8 @@ import java.time.LocalDateTime
class HomeFollowingQueryService(
private val queryPort: HomeFollowingQueryPort,
private val memberContentPreferenceService: MemberContentPreferenceService,
private val langContext: LangContext,
private val creatorCommunityTranslationService: CreatorCommunityTranslationService,
private val nowProvider: () -> LocalDateTime = { LocalDateTime.now(Clock.systemUTC()) }
) {
fun findHomeFollowing(member: Member): HomeFollowing {
@@ -24,6 +29,15 @@ class HomeFollowingQueryService(
val effectiveViewerGender = member.effectiveGender()
val isViewerCreator = member.role == MemberRole.CREATOR
val now = nowProvider()
val recentNews = queryPort.findRecentNews(memberId, canViewAdultContent, now, RECENT_NEWS_LIMIT)
val communityPostIds = recentNews.mapNotNull { news ->
if (news.type == FollowingNewsType.COMMUNITY_POST) news.communityPost?.postId else null
}
val displayContents = if (communityPostIds.isEmpty()) {
emptyMap()
} else {
creatorCommunityTranslationService.findDisplayContents(communityPostIds, langContext.lang.code)
}
return HomeFollowing(
followingCreators = queryPort.findFollowingCreators(memberId, FOLLOWING_CREATORS_LIMIT),
@@ -43,7 +57,14 @@ class HomeFollowingQueryService(
now,
MONTHLY_SCHEDULES_LIMIT
),
recentNews = queryPort.findRecentNews(memberId, canViewAdultContent, now, RECENT_NEWS_LIMIT)
recentNews = recentNews.map { news ->
if (news.type != FollowingNewsType.COMMUNITY_POST) return@map news
val communityPost = news.communityPost ?: return@map news
displayContents[communityPost.postId]
?.let { displayContent -> news.copy(communityPost = communityPost.copy(content = displayContent.content)) }
?: news
}
)
}