홈 크리에이터 랭킹 팔로우 조회 최적화

홈 API의 크리에이터 랭킹 응답에서 팔로우 여부를 일괄 조회로 계산한다.
This commit is contained in:
2026-02-12 16:15:58 +09:00
parent 232d97e37e
commit 1ca7e1744d
2 changed files with 30 additions and 11 deletions

View File

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