feat(channel-home): 숨긴 후원을 제외하고 소유자에게 후원 ID를 제공한다
This commit is contained in:
+4
@@ -1,5 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.v2.api.creator.channel.home.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
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
|
||||
@@ -109,6 +110,8 @@ data class CreatorChannelLiveResponse(
|
||||
}
|
||||
|
||||
data class CreatorChannelDonationResponse(
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
val donationId: Long?,
|
||||
val nickname: String,
|
||||
val profileImageUrl: String,
|
||||
val can: Int,
|
||||
@@ -120,6 +123,7 @@ data class CreatorChannelDonationResponse(
|
||||
companion object {
|
||||
fun from(donation: CreatorChannelDonation): CreatorChannelDonationResponse {
|
||||
return CreatorChannelDonationResponse(
|
||||
donationId = donation.donationId,
|
||||
nickname = donation.nickname,
|
||||
profileImageUrl = donation.profileImageUrl,
|
||||
can = donation.can,
|
||||
|
||||
+2
@@ -195,6 +195,7 @@ class DefaultCreatorChannelHomeQueryRepository(
|
||||
.select(
|
||||
Projections.constructor(
|
||||
CreatorChannelDonationRecord::class.java,
|
||||
channelDonationMessage.id,
|
||||
channelDonationMessage.member.id,
|
||||
donorName.displayName,
|
||||
channelDonationMessage.member.profileImage,
|
||||
@@ -210,6 +211,7 @@ class DefaultCreatorChannelHomeQueryRepository(
|
||||
.leftJoin(donorName.name).on(donorName.condition)
|
||||
.where(
|
||||
channelDonationMessage.creator.id.eq(creatorId),
|
||||
channelDonationMessage.isHidden.isFalse,
|
||||
channelDonationMessage.createdAt.goe(start),
|
||||
channelDonationMessage.createdAt.lt(end)
|
||||
)
|
||||
|
||||
+4
-2
@@ -103,7 +103,7 @@ class CreatorChannelHomeQueryService(
|
||||
)?.toDomain(),
|
||||
latestAudioContent = latestAudioContent,
|
||||
channelDonations = queryPort.findChannelDonations(creatorId, viewerId, now, lang = lang)
|
||||
.map { it.toDomain(creatorId, viewerId, lang) },
|
||||
.map { it.toDomain(creatorId, viewer, lang) },
|
||||
notices = communityQueryService.findHomeCommunityPosts(
|
||||
creatorId = creatorId,
|
||||
viewerId = viewerId,
|
||||
@@ -197,9 +197,11 @@ class CreatorChannelHomeQueryService(
|
||||
isRented = isRented
|
||||
)
|
||||
|
||||
private fun CreatorChannelDonationRecord.toDomain(creatorId: Long, viewerId: Long, lang: Lang): CreatorChannelDonation {
|
||||
private fun CreatorChannelDonationRecord.toDomain(creatorId: Long, viewer: Member, lang: Lang): CreatorChannelDonation {
|
||||
val viewerId = viewer.id!!
|
||||
val isMasked = isSecret && viewerId != creatorId && viewerId != memberId
|
||||
return CreatorChannelDonation(
|
||||
donationId = donationId.takeIf { viewer.role == MemberRole.CREATOR && viewerId == creatorId },
|
||||
memberId = memberId,
|
||||
nickname = when {
|
||||
isMasked -> messageSource.getMessage("explorer.channel_donation.anonymous.nickname", lang).orEmpty()
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ data class CreatorChannelLive(
|
||||
)
|
||||
|
||||
data class CreatorChannelDonation(
|
||||
val donationId: Long?,
|
||||
val memberId: Long,
|
||||
val nickname: String,
|
||||
val profileImageUrl: String,
|
||||
|
||||
+1
@@ -114,6 +114,7 @@ data class CreatorChannelAudioContentRecord(
|
||||
)
|
||||
|
||||
data class CreatorChannelDonationRecord(
|
||||
val donationId: Long,
|
||||
val memberId: Long,
|
||||
val nickname: String,
|
||||
val profileImagePath: String?,
|
||||
|
||||
Reference in New Issue
Block a user