feat(recommendation): 인기 커뮤니티 좋아요 조회를 추가한다
This commit is contained in:
@@ -792,7 +792,8 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
creatorCommunity.createdAt,
|
||||
creatorCommunityLike.id.countDistinct(),
|
||||
creatorCommunityComment.id.countDistinct(),
|
||||
orderedCommunityPostCondition(memberId)
|
||||
orderedCommunityPostCondition(memberId),
|
||||
likedCommunityPostCondition(memberId)
|
||||
)
|
||||
)
|
||||
.from(creatorCommunity)
|
||||
@@ -1229,6 +1230,19 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
.exists()
|
||||
}
|
||||
|
||||
private fun likedCommunityPostCondition(memberId: Long?): BooleanExpression {
|
||||
if (memberId == null) return Expressions.FALSE
|
||||
return JPAExpressions
|
||||
.selectOne()
|
||||
.from(creatorCommunityLike)
|
||||
.where(
|
||||
creatorCommunityLike.creatorCommunity.id.eq(creatorCommunity.id),
|
||||
creatorCommunityLike.member.id.eq(memberId),
|
||||
creatorCommunityLike.isActive.isTrue
|
||||
)
|
||||
.exists()
|
||||
}
|
||||
|
||||
private fun notBlockedCreatorSql(creatorIdExpression: String): String {
|
||||
return """
|
||||
not exists (
|
||||
|
||||
@@ -152,7 +152,8 @@ data class HomePopularCommunityRecommendationRecord(
|
||||
val createdAt: LocalDateTime,
|
||||
val likeCount: Long,
|
||||
val commentCount: Long,
|
||||
val existOrdered: Boolean
|
||||
val existOrdered: Boolean,
|
||||
val isLiked: Boolean
|
||||
)
|
||||
|
||||
data class HomeGenreCreatorRecommendationGroup(
|
||||
|
||||
Reference in New Issue
Block a user