From 297f6555f31940087e77a83e7300211364490448 Mon Sep 17 00:00:00 2001 From: Klaus Date: Mon, 11 Nov 2024 12:37:14 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=B0=A9=20-=20?= =?UTF-8?q?=ED=9B=84=EC=9B=90=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20-=20=EB=B0=A9=EC=9E=A5=EC=9D=80=20?= =?UTF-8?q?=EB=AA=A8=EB=93=A0=20=ED=9B=84=EC=9B=90=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EB=B3=BC=20=EC=88=98=20=EC=9E=88=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/live/room/LiveRoomRepository.kt | 12 ++++++++++++ .../vividnext/sodalive/live/room/LiveRoomService.kt | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt index d1fe8f2..3445f6a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomRepository.kt @@ -56,6 +56,7 @@ interface LiveRoomQueryRepository { fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List fun getActiveRoomIdList(memberId: Long): Int fun getTotalHeartCount(roomId: Long): Int? + fun getLiveRoomCreatorId(roomId: Long): Long? } class LiveRoomQueryRepositoryImpl( @@ -334,4 +335,15 @@ class LiveRoomQueryRepositoryImpl( .where(where) .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() + } } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt index 6f23069..4c31c80 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt @@ -885,11 +885,18 @@ class LiveRoomService( } fun getDonationMessageList(roomId: Long, member: Member): List { + val liveRoomCreatorId = repository.getLiveRoomCreatorId(roomId) + ?: throw SodaException("해당하는 라이브의 정보가 없습니다.") + val roomInfo = roomInfoRepository.findByIdOrNull(roomId) ?: throw SodaException("해당하는 라이브의 정보가 없습니다.") - return roomInfo.donationMessageList - .filter { !it.isSecret || it.memberId == member.id!! } + return if (liveRoomCreatorId != member.id!!) { + roomInfo.donationMessageList + .filter { !it.isSecret || it.memberId == member.id!! } + } else { + roomInfo.donationMessageList + } } fun deleteDonationMessage(request: DeleteLiveRoomDonationMessage, member: Member) {