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 c64de8ab..849a1adc 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 @@ -89,11 +89,13 @@ class LiveRoomQueryRepositoryImpl( .and(liveRoom.isActive.isTrue) .and(liveRoom.member.isNotNull) - if (!isAdult) { + val isAdultRestricted = !isAdult || memberId == 17L || memberId == 16L + if (isAdultRestricted) { where = where.and(liveRoom.isAdult.isFalse) } - if (isCreator && memberId != null) { + val hasMemberId = memberId != null + if (isCreator && hasMemberId) { where = where.and( liveRoom.isAvailableJoinCreator.isTrue .or(liveRoom.member.id.eq(memberId)) @@ -106,7 +108,7 @@ class LiveRoomQueryRepositoryImpl( Gender.FEMALE -> liveRoom.genderRestriction.`in`(GenderRestriction.ALL, GenderRestriction.FEMALE_ONLY) Gender.NONE -> liveRoom.genderRestriction.isNotNull } - where = if (memberId != null) { + where = if (hasMemberId) { where.and(genderCondition.or(liveRoom.member.id.eq(memberId))) } else { where.and(genderCondition) @@ -118,7 +120,7 @@ class LiveRoomQueryRepositoryImpl( .innerJoin(liveRoom.member, member) .leftJoin(quarterLiveRankings).on(liveRoom.id.eq(quarterLiveRankings.roomId)) - if (memberId != null) { + if (hasMemberId) { val blockMemberCondition = blockMember.member.id.eq(member.id) .and(blockMember.blockedMember.id.eq(memberId)) .and(blockMember.isActive.isTrue) @@ -158,7 +160,8 @@ class LiveRoomQueryRepositoryImpl( .and(liveRoom.isActive.isTrue) .and(liveRoom.member.isNotNull) - if (!isAdult) { + val isAdultRestricted = !isAdult || memberId == 17L || memberId == 16L + if (isAdultRestricted) { where = where.and(liveRoom.isAdult.isFalse) } @@ -223,7 +226,8 @@ class LiveRoomQueryRepositoryImpl( .and(liveRoom.isActive.isTrue) .and(liveRoom.member.isNotNull) - if (!isAdult) { + val isAdultRestricted = !isAdult || memberId == 17L || memberId == 16L + if (isAdultRestricted) { where = where.and(liveRoom.isAdult.isFalse) }