홈 크리에이터 랭킹 팔로우 조회 최적화
홈 API의 크리에이터 랭킹 응답에서 팔로우 여부를 일괄 조회로 계산한다.
This commit is contained in:
@@ -637,6 +637,23 @@ class ExplorerQueryRepository(
|
||||
.fetchOne() ?: false
|
||||
}
|
||||
|
||||
fun getFollowedCreatorIds(creatorIds: List<Long>, memberId: Long): Set<Long> {
|
||||
if (creatorIds.isEmpty()) {
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(creatorFollowing.creator.id)
|
||||
.from(creatorFollowing)
|
||||
.where(
|
||||
creatorFollowing.isActive.isTrue
|
||||
.and(creatorFollowing.creator.id.`in`(creatorIds))
|
||||
.and(creatorFollowing.member.id.eq(memberId))
|
||||
)
|
||||
.fetch()
|
||||
.toSet()
|
||||
}
|
||||
|
||||
fun getCreatorCheers(cheersId: Long): CreatorCheers? {
|
||||
return queryFactory
|
||||
.selectFrom(creatorCheers)
|
||||
|
||||
Reference in New Issue
Block a user