|
|
|
|
@@ -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,17 +43,19 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact
|
|
|
|
|
|
|
|
|
|
override fun getCommunityPostList(
|
|
|
|
|
creatorId: Long,
|
|
|
|
|
memberId: Long,
|
|
|
|
|
offset: Long,
|
|
|
|
|
limit: Long,
|
|
|
|
|
isAdult: Boolean
|
|
|
|
|
): List<SelectCommunityPostResponse> {
|
|
|
|
|
var where = creatorCommunity.member.id.eq(creatorId)
|
|
|
|
|
.and(creatorCommunity.isActive.isTrue)
|
|
|
|
|
var where = creatorCommunity.isActive.isTrue
|
|
|
|
|
|
|
|
|
|
if (!isAdult) {
|
|
|
|
|
where = where.and(creatorCommunity.isAdult.isFalse)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
where = where.or(useCan.communityPost.isNotNull)
|
|
|
|
|
|
|
|
|
|
return queryFactory
|
|
|
|
|
.select(
|
|
|
|
|
QSelectCommunityPostResponse(
|
|
|
|
|
@@ -67,7 +71,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)
|
|
|
|
|
|