라이브
- 예약 개수 최대 3개까지로 한정
This commit is contained in:
@@ -52,6 +52,7 @@ interface LiveRoomQueryRepository {
|
||||
fun getDonationTotal(roomId: Long, isLiveCreator: Boolean): Int?
|
||||
fun getDonationList(roomId: Long, isLiveCreator: Boolean): List<GetLiveRoomDonationItem>
|
||||
fun getRoomActiveAndChannelNameIsNotNull(memberId: Long): List<LiveRoom>
|
||||
fun getActiveRoomIdList(memberId: Long): Int
|
||||
}
|
||||
|
||||
class LiveRoomQueryRepositoryImpl(
|
||||
@@ -283,4 +284,16 @@ class LiveRoomQueryRepositoryImpl(
|
||||
)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
override fun getActiveRoomIdList(memberId: Long): Int {
|
||||
return queryFactory
|
||||
.select(liveRoom.id)
|
||||
.from(liveRoom)
|
||||
.where(
|
||||
liveRoom.isActive.isTrue
|
||||
.and(liveRoom.member.id.eq(memberId))
|
||||
)
|
||||
.fetch()
|
||||
.size
|
||||
}
|
||||
}
|
||||
|
@@ -247,6 +247,10 @@ class LiveRoomService(
|
||||
|
||||
@Transactional
|
||||
fun createLiveRoom(coverImage: MultipartFile?, requestString: String, member: Member): CreateLiveRoomResponse {
|
||||
if (repository.getActiveRoomIdList(memberId = member.id!!) >= 3) {
|
||||
throw SodaException("라이브 예약은 최대 3개까지 가능합니다.")
|
||||
}
|
||||
|
||||
val request = objectMapper.readValue(requestString, CreateLiveRoomRequest::class.java)
|
||||
if (request.coverImageUrl == null && coverImage == null) {
|
||||
throw SodaException("커버이미지를 선택해 주세요.")
|
||||
|
Reference in New Issue
Block a user