라이브 방
- 엔티티 크리에이터 입장 가능 플래그 추가 - 라이브 방 생성시 크리에이터 입장 가능 여부 추가 - 라이브 방 조회시 크리에이터 입장 가능 여부 추가
This commit is contained in:
parent
f9a8b431e0
commit
33130140fd
|
@ -14,5 +14,6 @@ data class CreateLiveRoomRequest(
|
||||||
val password: String? = null,
|
val password: String? = null,
|
||||||
val menuPanId: Long = 0,
|
val menuPanId: Long = 0,
|
||||||
val menuPan: String = "",
|
val menuPan: String = "",
|
||||||
val isActiveMenuPan: Boolean = false
|
val isActiveMenuPan: Boolean = false,
|
||||||
|
val isAvailableJoinCreator: Boolean = true
|
||||||
)
|
)
|
||||||
|
|
|
@ -28,6 +28,7 @@ data class LiveRoom(
|
||||||
var bgImage: String? = null,
|
var bgImage: String? = null,
|
||||||
var isAdult: Boolean,
|
var isAdult: Boolean,
|
||||||
val price: Int = 0,
|
val price: Int = 0,
|
||||||
|
val isAvailableJoinCreator: Boolean = true,
|
||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
val type: LiveRoomType = LiveRoomType.OPEN,
|
val type: LiveRoomType = LiveRoomType.OPEN,
|
||||||
@Column(nullable = true)
|
@Column(nullable = true)
|
||||||
|
|
|
@ -20,16 +20,28 @@ import java.time.ZoneId
|
||||||
interface LiveRoomRepository : JpaRepository<LiveRoom, Long>, LiveRoomQueryRepository
|
interface LiveRoomRepository : JpaRepository<LiveRoom, Long>, LiveRoomQueryRepository
|
||||||
|
|
||||||
interface LiveRoomQueryRepository {
|
interface LiveRoomQueryRepository {
|
||||||
fun getLiveRoomListNow(offset: Long, limit: Long, timezone: String, isAdult: Boolean): List<LiveRoom>
|
fun getLiveRoomListNow(
|
||||||
|
offset: Long,
|
||||||
|
limit: Long,
|
||||||
|
timezone: String,
|
||||||
|
isCreator: Boolean,
|
||||||
|
isAdult: Boolean
|
||||||
|
): List<LiveRoom>
|
||||||
|
|
||||||
fun getLiveRoomListReservationWithDate(
|
fun getLiveRoomListReservationWithDate(
|
||||||
date: LocalDateTime,
|
date: LocalDateTime,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long,
|
limit: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
): List<LiveRoom>
|
): List<LiveRoom>
|
||||||
|
|
||||||
fun getLiveRoomListReservationWithoutDate(timezone: String, memberId: Long, isAdult: Boolean): List<LiveRoom>
|
fun getLiveRoomListReservationWithoutDate(
|
||||||
|
timezone: String,
|
||||||
|
memberId: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
|
isAdult: Boolean
|
||||||
|
): List<LiveRoom>
|
||||||
|
|
||||||
fun getLiveRoom(id: Long): LiveRoom?
|
fun getLiveRoom(id: Long): LiveRoom?
|
||||||
fun getLiveRoomAndAccountId(roomId: Long, memberId: Long): LiveRoom?
|
fun getLiveRoomAndAccountId(roomId: Long, memberId: Long): LiveRoom?
|
||||||
|
@ -40,7 +52,13 @@ interface LiveRoomQueryRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : LiveRoomQueryRepository {
|
class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : LiveRoomQueryRepository {
|
||||||
override fun getLiveRoomListNow(offset: Long, limit: Long, timezone: String, isAdult: Boolean): List<LiveRoom> {
|
override fun getLiveRoomListNow(
|
||||||
|
offset: Long,
|
||||||
|
limit: Long,
|
||||||
|
timezone: String,
|
||||||
|
isCreator: Boolean,
|
||||||
|
isAdult: Boolean
|
||||||
|
): List<LiveRoom> {
|
||||||
var where = liveRoom.channelName.isNotNull
|
var where = liveRoom.channelName.isNotNull
|
||||||
.and(liveRoom.channelName.isNotEmpty)
|
.and(liveRoom.channelName.isNotEmpty)
|
||||||
.and(liveRoom.isActive.isTrue)
|
.and(liveRoom.isActive.isTrue)
|
||||||
|
@ -50,6 +68,10 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
||||||
where = where.and(liveRoom.isAdult.isFalse)
|
where = where.and(liveRoom.isAdult.isFalse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCreator) {
|
||||||
|
where = where.and(liveRoom.isAvailableJoinCreator.isTrue)
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(liveRoom)
|
.selectFrom(liveRoom)
|
||||||
.innerJoin(liveRoom.member, member)
|
.innerJoin(liveRoom.member, member)
|
||||||
|
@ -70,6 +92,7 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
||||||
date: LocalDateTime,
|
date: LocalDateTime,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long,
|
limit: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
): List<LiveRoom> {
|
): List<LiveRoom> {
|
||||||
var where = liveRoom.beginDateTime.goe(date)
|
var where = liveRoom.beginDateTime.goe(date)
|
||||||
|
@ -85,6 +108,10 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
||||||
where = where.and(liveRoom.isAdult.isFalse)
|
where = where.and(liveRoom.isAdult.isFalse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCreator) {
|
||||||
|
where = where.and(liveRoom.isAvailableJoinCreator.isTrue)
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(liveRoom)
|
.selectFrom(liveRoom)
|
||||||
.innerJoin(liveRoom.member, member)
|
.innerJoin(liveRoom.member, member)
|
||||||
|
@ -98,6 +125,7 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
||||||
override fun getLiveRoomListReservationWithoutDate(
|
override fun getLiveRoomListReservationWithoutDate(
|
||||||
timezone: String,
|
timezone: String,
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
): List<LiveRoom> {
|
): List<LiveRoom> {
|
||||||
var where = liveRoom.beginDateTime.gt(
|
var where = liveRoom.beginDateTime.gt(
|
||||||
|
@ -117,6 +145,10 @@ class LiveRoomQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : L
|
||||||
where = where.and(liveRoom.isAdult.isFalse)
|
where = where.and(liveRoom.isAdult.isFalse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCreator) {
|
||||||
|
where = where.and(liveRoom.isAvailableJoinCreator.isTrue)
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(liveRoom)
|
.selectFrom(liveRoom)
|
||||||
.innerJoin(liveRoom.member, member)
|
.innerJoin(liveRoom.member, member)
|
||||||
|
|
|
@ -118,17 +118,24 @@ class LiveRoomService(
|
||||||
timezone: String
|
timezone: String
|
||||||
): List<GetRoomListResponse> {
|
): List<GetRoomListResponse> {
|
||||||
val roomList = if (status == LiveRoomStatus.NOW) {
|
val roomList = if (status == LiveRoomStatus.NOW) {
|
||||||
getLiveRoomListNow(pageable, timezone, isAdult = member.auth != null)
|
getLiveRoomListNow(
|
||||||
|
pageable,
|
||||||
|
timezone,
|
||||||
|
isCreator = member.role == MemberRole.CREATOR,
|
||||||
|
isAdult = member.auth != null
|
||||||
|
)
|
||||||
} else if (dateString != null) {
|
} else if (dateString != null) {
|
||||||
getLiveRoomListReservationWithDate(
|
getLiveRoomListReservationWithDate(
|
||||||
dateString,
|
dateString,
|
||||||
pageable,
|
pageable,
|
||||||
timezone,
|
timezone,
|
||||||
|
isCreator = member.role == MemberRole.CREATOR,
|
||||||
isAdult = member.auth != null
|
isAdult = member.auth != null
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
getLiveRoomListReservationWithoutDate(
|
getLiveRoomListReservationWithoutDate(
|
||||||
timezone,
|
timezone,
|
||||||
|
isCreator = member.role == MemberRole.CREATOR,
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
isAdult = member.auth != null
|
isAdult = member.auth != null
|
||||||
)
|
)
|
||||||
|
@ -186,11 +193,17 @@ class LiveRoomService(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLiveRoomListNow(pageable: Pageable, timezone: String, isAdult: Boolean): List<LiveRoom> {
|
private fun getLiveRoomListNow(
|
||||||
|
pageable: Pageable,
|
||||||
|
timezone: String,
|
||||||
|
isCreator: Boolean,
|
||||||
|
isAdult: Boolean
|
||||||
|
): List<LiveRoom> {
|
||||||
return repository.getLiveRoomListNow(
|
return repository.getLiveRoomListNow(
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong(),
|
limit = pageable.pageSize.toLong(),
|
||||||
timezone = timezone,
|
timezone = timezone,
|
||||||
|
isCreator = isCreator,
|
||||||
isAdult = isAdult
|
isAdult = isAdult
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -199,6 +212,7 @@ class LiveRoomService(
|
||||||
dateString: String,
|
dateString: String,
|
||||||
pageable: Pageable,
|
pageable: Pageable,
|
||||||
timezone: String,
|
timezone: String,
|
||||||
|
isCreator: Boolean,
|
||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
): List<LiveRoom> {
|
): List<LiveRoom> {
|
||||||
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||||
|
@ -211,6 +225,7 @@ class LiveRoomService(
|
||||||
date = date,
|
date = date,
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong(),
|
limit = pageable.pageSize.toLong(),
|
||||||
|
isCreator = isCreator,
|
||||||
isAdult = isAdult
|
isAdult = isAdult
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -218,9 +233,10 @@ class LiveRoomService(
|
||||||
private fun getLiveRoomListReservationWithoutDate(
|
private fun getLiveRoomListReservationWithoutDate(
|
||||||
timezone: String,
|
timezone: String,
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
): List<LiveRoom> {
|
): List<LiveRoom> {
|
||||||
return repository.getLiveRoomListReservationWithoutDate(timezone, memberId, isAdult)
|
return repository.getLiveRoomListReservationWithoutDate(timezone, memberId, isCreator, isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -277,7 +293,8 @@ class LiveRoomService(
|
||||||
request.price
|
request.price
|
||||||
},
|
},
|
||||||
type = request.type,
|
type = request.type,
|
||||||
password = request.password
|
password = request.password,
|
||||||
|
isAvailableJoinCreator = request.isAvailableJoinCreator
|
||||||
)
|
)
|
||||||
room.member = member
|
room.member = member
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue