크리에이터 커뮤니티

- 구매한 유료게시물은 크리에이터가 삭제하더라도 조회되도록 수정
This commit is contained in:
Klaus 2024-07-10 14:12:18 +09:00
parent dbc5d6c31e
commit bf01bb66e5
2 changed files with 17 additions and 3 deletions

View File

@ -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<SelectCommunityPostResponse> {
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)

View File

@ -150,6 +150,7 @@ class CreatorCommunityService(
val postList = repository.getCommunityPostList(
creatorId = creatorId,
memberId = memberId,
offset = offset,
limit = limit,
isAdult = isAdult