feat(creator-channel): 홈 커뮤니티 조회를 공용 서비스로 연결한다
This commit is contained in:
@@ -3,8 +3,8 @@ package kr.co.vividnext.sodalive.v2.api.creator.channel.home.dto
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import kr.co.vividnext.sodalive.v2.api.creator.channel.common.dto.CreatorChannelAudioContentResponse
|
||||
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityPost
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCommunityPost
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCreator
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
||||
@@ -195,7 +195,7 @@ data class CreatorChannelCommunityPostResponse(
|
||||
audioUrl = post.audioUrl,
|
||||
content = post.content,
|
||||
price = post.price,
|
||||
dateUtc = post.date.toUtcIso(),
|
||||
dateUtc = post.createdAt.toUtcIso(),
|
||||
existOrdered = post.existOrdered,
|
||||
likeCount = post.likeCount,
|
||||
commentCount = post.commentCount
|
||||
|
||||
@@ -10,8 +10,8 @@ import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreference
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
||||
import kr.co.vividnext.sodalive.v2.common.domain.toCdnUrl
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.common.domain.CreatorChannelAudioContent
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.application.CreatorChannelCommunityQueryService
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCommunityPost
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCreator
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
||||
@@ -24,7 +24,6 @@ import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSer
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSns
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelActivityRecord
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelAudioContentRecord
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelCommunityPostRecord
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelCreatorRecord
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelDonationRecord
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelFanTalkRecord
|
||||
@@ -43,6 +42,7 @@ import java.time.LocalDateTime
|
||||
@Transactional(readOnly = true)
|
||||
class CreatorChannelHomeQueryService(
|
||||
private val queryPort: CreatorChannelHomeQueryPort,
|
||||
private val communityQueryService: CreatorChannelCommunityQueryService,
|
||||
private val queryPolicy: CreatorChannelHomeQueryPolicy,
|
||||
private val memberContentPreferenceService: MemberContentPreferenceService,
|
||||
private val messageSource: SodaMessageSource,
|
||||
@@ -98,12 +98,13 @@ class CreatorChannelHomeQueryService(
|
||||
)?.toDomain(),
|
||||
latestAudioContent = latestAudioContent,
|
||||
channelDonations = queryPort.findChannelDonations(creatorId, viewerId, now).map { it.toDomain() },
|
||||
notices = queryPort.findCommunityPosts(
|
||||
notices = communityQueryService.findHomeCommunityPosts(
|
||||
creatorId = creatorId,
|
||||
viewerId = viewerId,
|
||||
isFixed = true,
|
||||
canViewAdultContent = canViewAdultContent
|
||||
).map { it.toDomain() },
|
||||
isPinned = true,
|
||||
canViewAdultContent = canViewAdultContent,
|
||||
limit = 3
|
||||
),
|
||||
schedules = queryPolicy.limitSchedules(
|
||||
queryPort.findSchedules(
|
||||
creatorId = creatorId,
|
||||
@@ -124,12 +125,13 @@ class CreatorChannelHomeQueryService(
|
||||
canViewAdultContent = canViewAdultContent,
|
||||
contentType = preference.contentType
|
||||
).map { it.toDomain() },
|
||||
communities = queryPort.findCommunityPosts(
|
||||
communities = communityQueryService.findHomeCommunityPosts(
|
||||
creatorId = creatorId,
|
||||
viewerId = viewerId,
|
||||
isFixed = false,
|
||||
canViewAdultContent = canViewAdultContent
|
||||
).map { it.toDomain() },
|
||||
isPinned = false,
|
||||
canViewAdultContent = canViewAdultContent,
|
||||
limit = 3
|
||||
),
|
||||
fanTalk = queryPort.findFanTalkSummary(creatorId, viewerId).toDomain(),
|
||||
introduce = creator.introduce,
|
||||
activity = queryPort.findActivity(creatorId, now).toDomain(),
|
||||
@@ -210,21 +212,6 @@ class CreatorChannelHomeQueryService(
|
||||
isOriginal = isOriginal
|
||||
)
|
||||
|
||||
private fun CreatorChannelCommunityPostRecord.toDomain() = CreatorChannelCommunityPost(
|
||||
postId = postId,
|
||||
creatorId = creatorId,
|
||||
creatorNickname = creatorNickname,
|
||||
creatorProfileUrl = creatorProfilePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(),
|
||||
imageUrl = imagePath.toCdnUrl(cloudFrontHost),
|
||||
audioUrl = audioPath.toCdnUrl(cloudFrontHost),
|
||||
content = content,
|
||||
price = price,
|
||||
date = date,
|
||||
existOrdered = existOrdered,
|
||||
likeCount = likeCount,
|
||||
commentCount = commentCount
|
||||
)
|
||||
|
||||
private fun CreatorChannelFanTalkSummaryRecord.toDomain() = CreatorChannelFanTalkSummary(
|
||||
totalCount = totalCount,
|
||||
latestFanTalk = latestFanTalk?.toDomain()
|
||||
|
||||
@@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.v2.creator.channel.home.domain
|
||||
|
||||
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.common.domain.CreatorChannelAudioContent
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityPost
|
||||
import java.time.LocalDateTime
|
||||
|
||||
data class CreatorChannelHome(
|
||||
@@ -66,21 +67,6 @@ data class CreatorChannelSeries(
|
||||
val isOriginal: Boolean
|
||||
)
|
||||
|
||||
data class CreatorChannelCommunityPost(
|
||||
val postId: Long,
|
||||
val creatorId: Long,
|
||||
val creatorNickname: String,
|
||||
val creatorProfileUrl: String,
|
||||
val imageUrl: String?,
|
||||
val audioUrl: String?,
|
||||
val content: String,
|
||||
val price: Int,
|
||||
val date: LocalDateTime,
|
||||
val existOrdered: Boolean,
|
||||
val likeCount: Int,
|
||||
val commentCount: Int
|
||||
)
|
||||
|
||||
data class CreatorChannelFanTalkSummary(
|
||||
val totalCount: Int,
|
||||
val latestFanTalk: CreatorChannelFanTalk?
|
||||
|
||||
Reference in New Issue
Block a user