라이브방 후원리스트

- 내가 후원한 비밀후원은 조회되도록 수정
This commit is contained in:
Klaus 2024-11-05 15:14:39 +09:00
parent 8ea51774e6
commit a5845c90c2
2 changed files with 15 additions and 6 deletions

View File

@ -52,7 +52,7 @@ interface LiveRoomQueryRepository {
fun getLiveRoomAndAccountId(roomId: Long, memberId: Long): LiveRoom?
fun getRecentRoomInfo(memberId: Long): GetRecentRoomInfoResponse?
fun getDonationTotal(roomId: Long): Int?
fun getDonationList(roomId: Long, isLiveCreator: Boolean): List<GetLiveRoomDonationItem>
fun getDonationList(roomId: Long, isLiveCreator: Boolean, memberId: Long): List<GetLiveRoomDonationItem>
fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom>
fun getActiveRoomIdList(memberId: Long): Int
fun getTotalHeartCount(roomId: Long): Int?
@ -244,7 +244,7 @@ class LiveRoomQueryRepositoryImpl(
.fetchOne()
}
override fun getDonationList(roomId: Long, isLiveCreator: Boolean): List<GetLiveRoomDonationItem> {
override fun getDonationList(roomId: Long, isLiveCreator: Boolean, memberId: Long): List<GetLiveRoomDonationItem> {
val where = liveRoom.id.eq(roomId)
.and(useCan.canUsage.eq(CanUsage.DONATION).or(useCan.canUsage.eq(CanUsage.SPIN_ROULETTE)))
.and(useCan.isRefund.isFalse)
@ -253,7 +253,7 @@ class LiveRoomQueryRepositoryImpl(
useCan.can.sum().add(useCan.rewardCan.sum())
} else {
CaseBuilder()
.`when`(useCan.isSecret.isFalse)
.`when`(useCan.isSecret.isFalse.or(useCan.member.id.eq(memberId)))
.then(useCan.can.sum().add(useCan.rewardCan.sum()))
.otherwise(0)
}

View File

@ -1176,10 +1176,19 @@ class LiveRoomService(
fun getDonationStatus(roomId: Long, memberId: Long): GetLiveRoomDonationStatusResponse {
val room = repository.getLiveRoom(roomId) ?: throw SodaException("잘못된 요청입니다.")
val isLiveCreator = room.member!!.id == memberId
val donationList = repository.getDonationList(roomId = room.id!!, isLiveCreator = isLiveCreator)
.filter { it.secretCan > 0 || it.can > 0 }
val donationList = repository.getDonationList(
roomId = room.id!!,
isLiveCreator = isLiveCreator,
memberId = memberId
).filter { it.secretCan > 0 || it.can > 0 }
val totalCan = donationList.sumOf { it.can }
val totalSecretCan = donationList.sumOf { it.secretCan }
val totalSecretCan = if (isLiveCreator) {
donationList.sumOf { it.secretCan }
} else {
0
}
return GetLiveRoomDonationStatusResponse(
donationList = donationList,