지금 즉시 라이브 만들기, 라이브 시작

- 라이브 시작시 본인 라이브 만이 아닌 진행 중인 모든 라이브 삭제 되는 버그 수정
This commit is contained in:
Klaus 2023-12-10 21:26:15 +09:00
parent 13088f53a6
commit 80930ebd3d
2 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,7 @@ interface LiveRoomQueryRepository {
fun getRecentRoomInfo(memberId: Long, cloudFrontHost: String): GetRecentRoomInfoResponse?
fun getDonationTotal(roomId: Long): Int?
fun getDonationList(roomId: Long, cloudFrontHost: String): List<GetLiveRoomDonationItem>
fun getRoomActiveAndChannelNameIsNotNull(): List<LiveRoom>
fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom>
}
class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : LiveRoomQueryRepository {
@ -191,12 +191,13 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
.fetch()
}
override fun getRoomActiveAndChannelNameIsNotNull(): List<LiveRoom> {
override fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom> {
return queryFactory
.selectFrom(liveRoom)
.where(
liveRoom.isActive.isTrue
.and(liveRoom.channelName.isNotNull)
.and(liveRoom.member.id.eq(memberId))
)
.fetch()
}

View File

@ -183,7 +183,7 @@ class LiveRoomService(
}
if (now == beginDateTime) {
val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull()
val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull(memberId = member.id!!)
for (activeRoom in activeRooms) {
activeRoom.isActive = false
}
@ -410,7 +410,7 @@ class LiveRoomService(
throw SodaException("$startAvailableDateTimeString 이후에 시작할 수 있습니다.")
}
val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull()
val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull(memberId = member.id!!)
for (activeRoom in activeRooms) {
activeRoom.isActive = false
}