diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt index 16247ae..2ae3834 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityRepository.kt @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.explorer.profile.creatorCommunity import com.querydsl.core.types.dsl.Expressions import com.querydsl.jpa.impl.JPAQueryFactory +import kr.co.vividnext.sodalive.can.use.QUseCan.useCan import kr.co.vividnext.sodalive.explorer.profile.creatorCommunity.QCreatorCommunity.creatorCommunity import kr.co.vividnext.sodalive.member.QMember.member import kr.co.vividnext.sodalive.member.following.QCreatorFollowing.creatorFollowing @@ -17,6 +18,7 @@ interface CreatorCommunityQueryRepository { fun getCommunityPostList( creatorId: Long, + memberId: Long, offset: Long, limit: Long, isAdult: Boolean @@ -41,12 +43,13 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact override fun getCommunityPostList( creatorId: Long, + memberId: Long, offset: Long, limit: Long, isAdult: Boolean ): List { - var where = creatorCommunity.member.id.eq(creatorId) - .and(creatorCommunity.isActive.isTrue) + var where = creatorCommunity.isActive.isTrue + .or(useCan.communityPost.isNotNull) if (!isAdult) { where = where.and(creatorCommunity.isAdult.isFalse) @@ -67,7 +70,17 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact ) ) .from(creatorCommunity) - .innerJoin(creatorCommunity.member, member) + .innerJoin(member) + .on( + creatorCommunity.member.id.eq(member.id) + .and(member.id.eq(creatorId)) + ) + .leftJoin(useCan) + .on( + creatorCommunity.id.eq(useCan.communityPost.id) + .and(useCan.member.id.eq(memberId)) + .and(useCan.isRefund.isFalse) + ) .where(where) .offset(offset) .limit(limit) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt index 44a3ed6..cf429c1 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/creatorCommunity/CreatorCommunityService.kt @@ -150,6 +150,7 @@ class CreatorCommunityService( val postList = repository.getCommunityPostList( creatorId = creatorId, + memberId = memberId, offset = offset, limit = limit, isAdult = isAdult