test #235
|
@ -56,6 +56,7 @@ interface LiveRoomQueryRepository {
|
||||||
fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom>
|
fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom>
|
||||||
fun getActiveRoomIdList(memberId: Long): Int
|
fun getActiveRoomIdList(memberId: Long): Int
|
||||||
fun getTotalHeartCount(roomId: Long): Int?
|
fun getTotalHeartCount(roomId: Long): Int?
|
||||||
|
fun getLiveRoomCreatorId(roomId: Long): Long?
|
||||||
}
|
}
|
||||||
|
|
||||||
class LiveRoomQueryRepositoryImpl(
|
class LiveRoomQueryRepositoryImpl(
|
||||||
|
@ -334,4 +335,15 @@ class LiveRoomQueryRepositoryImpl(
|
||||||
.where(where)
|
.where(where)
|
||||||
.fetchOne()
|
.fetchOne()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getLiveRoomCreatorId(roomId: Long): Long? {
|
||||||
|
return queryFactory
|
||||||
|
.select(liveRoom.member.id)
|
||||||
|
.from(liveRoom)
|
||||||
|
.where(
|
||||||
|
liveRoom.isActive.isTrue
|
||||||
|
.and(liveRoom.id.eq(roomId))
|
||||||
|
)
|
||||||
|
.fetchFirst()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -885,11 +885,18 @@ class LiveRoomService(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDonationMessageList(roomId: Long, member: Member): List<LiveRoomDonationMessage> {
|
fun getDonationMessageList(roomId: Long, member: Member): List<LiveRoomDonationMessage> {
|
||||||
|
val liveRoomCreatorId = repository.getLiveRoomCreatorId(roomId)
|
||||||
|
?: throw SodaException("해당하는 라이브의 정보가 없습니다.")
|
||||||
|
|
||||||
val roomInfo = roomInfoRepository.findByIdOrNull(roomId)
|
val roomInfo = roomInfoRepository.findByIdOrNull(roomId)
|
||||||
?: throw SodaException("해당하는 라이브의 정보가 없습니다.")
|
?: throw SodaException("해당하는 라이브의 정보가 없습니다.")
|
||||||
|
|
||||||
return roomInfo.donationMessageList
|
return if (liveRoomCreatorId != member.id!!) {
|
||||||
|
roomInfo.donationMessageList
|
||||||
.filter { !it.isSecret || it.memberId == member.id!! }
|
.filter { !it.isSecret || it.memberId == member.id!! }
|
||||||
|
} else {
|
||||||
|
roomInfo.donationMessageList
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteDonationMessage(request: DeleteLiveRoomDonationMessage, member: Member) {
|
fun deleteDonationMessage(request: DeleteLiveRoomDonationMessage, member: Member) {
|
||||||
|
|
Loading…
Reference in New Issue