feat(recommend): 인기 커뮤니티 게시글 상세 필드를 조회한다
This commit is contained in:
@@ -6,6 +6,8 @@ import com.querydsl.core.types.dsl.BooleanExpression
|
||||
import com.querydsl.core.types.dsl.Expressions
|
||||
import com.querydsl.jpa.JPAExpressions
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.can.use.CanUsage
|
||||
import kr.co.vividnext.sodalive.can.use.QUseCan.useCan
|
||||
import kr.co.vividnext.sodalive.chat.character.QChatCharacter.chatCharacter
|
||||
import kr.co.vividnext.sodalive.chat.original.QOriginalWork
|
||||
import kr.co.vividnext.sodalive.chat.room.ParticipantType
|
||||
@@ -773,10 +775,13 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
member.id,
|
||||
member.nickname,
|
||||
member.profileImage,
|
||||
creatorCommunity.imagePath,
|
||||
creatorCommunity.audioPath,
|
||||
creatorCommunity.content,
|
||||
creatorCommunity.createdAt,
|
||||
creatorCommunityLike.id.countDistinct(),
|
||||
creatorCommunityComment.id.countDistinct()
|
||||
creatorCommunityComment.id.countDistinct(),
|
||||
orderedCommunityPostCondition(memberId)
|
||||
)
|
||||
)
|
||||
.from(creatorCommunity)
|
||||
@@ -792,7 +797,6 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
.where(
|
||||
creatorCommunity.isActive.isTrue,
|
||||
member.isActive.isTrue,
|
||||
creatorCommunity.price.eq(0),
|
||||
creatorCommunity.isFixed.isFalse,
|
||||
includeAdultCommunityCondition(includeAdultCommunities),
|
||||
notBlockedCreatorCondition(memberId, member.id),
|
||||
@@ -803,6 +807,8 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
member.id,
|
||||
member.nickname,
|
||||
member.profileImage,
|
||||
creatorCommunity.imagePath,
|
||||
creatorCommunity.audioPath,
|
||||
creatorCommunity.content,
|
||||
creatorCommunity.createdAt
|
||||
)
|
||||
@@ -1054,6 +1060,20 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
.notExists()
|
||||
}
|
||||
|
||||
private fun orderedCommunityPostCondition(memberId: Long?): BooleanExpression {
|
||||
if (memberId == null) return Expressions.FALSE
|
||||
return JPAExpressions
|
||||
.selectOne()
|
||||
.from(useCan)
|
||||
.where(
|
||||
useCan.member.id.eq(memberId),
|
||||
useCan.isRefund.isFalse,
|
||||
useCan.communityPost.id.eq(creatorCommunity.id),
|
||||
useCan.canUsage.eq(CanUsage.PAID_COMMUNITY_POST)
|
||||
)
|
||||
.exists()
|
||||
}
|
||||
|
||||
private fun notBlockedCreatorSql(creatorIdExpression: String): String {
|
||||
return """
|
||||
not exists (
|
||||
|
||||
@@ -151,10 +151,13 @@ data class HomePopularCommunityRecommendationRecord(
|
||||
val creatorId: Long,
|
||||
val creatorNickname: String,
|
||||
val creatorProfileImage: String?,
|
||||
val imagePath: String?,
|
||||
val audioPath: String?,
|
||||
val content: String,
|
||||
val createdAt: LocalDateTime,
|
||||
val likeCount: Long,
|
||||
val commentCount: Long
|
||||
val commentCount: Long,
|
||||
val existOrdered: Boolean
|
||||
)
|
||||
|
||||
data class HomeGenreCreatorRecommendationGroup(
|
||||
|
||||
Reference in New Issue
Block a user