지금 즉시 라이브 만들기, 라이브 시작
- 라이브 시작시 기존에 진행 중인 라이브 삭제
This commit is contained in:
@@ -41,6 +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>
|
||||
}
|
||||
|
||||
class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : LiveRoomQueryRepository {
|
||||
@@ -190,6 +191,16 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
||||
.fetch()
|
||||
}
|
||||
|
||||
override fun getRoomActiveAndChannelNameIsNotNull(): List<LiveRoom> {
|
||||
return queryFactory
|
||||
.selectFrom(liveRoom)
|
||||
.where(
|
||||
liveRoom.isActive.isTrue
|
||||
.and(liveRoom.channelName.isNotNull)
|
||||
)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
private fun orderByFieldAccountId(
|
||||
memberId: Long,
|
||||
status: LiveRoomStatus,
|
||||
|
@@ -182,6 +182,13 @@ class LiveRoomService(
|
||||
now
|
||||
}
|
||||
|
||||
if (now == beginDateTime) {
|
||||
val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull()
|
||||
for (activeRoom in activeRooms) {
|
||||
activeRoom.isActive = false
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
request.beginDateTimeString != null &&
|
||||
beginDateTime < now.plusMinutes(30)
|
||||
@@ -403,6 +410,11 @@ class LiveRoomService(
|
||||
throw SodaException("$startAvailableDateTimeString 이후에 시작할 수 있습니다.")
|
||||
}
|
||||
|
||||
val activeRooms = repository.getRoomActiveAndChannelNameIsNotNull()
|
||||
for (activeRoom in activeRooms) {
|
||||
activeRoom.isActive = false
|
||||
}
|
||||
|
||||
val dateTime = nowDateTime
|
||||
.atZone(ZoneId.of("UTC"))
|
||||
.withZoneSameInstant(ZoneId.of(request.timezone))
|
||||
|
Reference in New Issue
Block a user