Skip to content

Commit

Permalink
fix: 응원자 조회 API 쿼리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
egg528 committed Feb 27, 2024
1 parent 47d6ea2 commit cb7c465
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ class CheeringService(
return if (contentSize < pageSize) {
true
} else {
!cheererRepository.existsByLifeMapIdAndCheeringAtGreaterThanOrderByCheeringAtDesc(lifeMapId, cheeringSquad.last().cheeringAt)
!cheererRepository.existsByLifeMapIdAndCheeringAtLessThanOrderByCheeringAtDesc(lifeMapId, cheeringSquad.last().cheeringAt)
}
}

private fun findCheeringSquadPage(lifeMapId: Long, cheeringAt: LocalDateTime?, pageable: Pageable): List<Cheerer> {
return if (cheeringAt == null) {
cheererRepository.findByLifeMapIdOrderByCheeringAtDesc(lifeMapId, pageable)
} else {
cheererRepository.findByLifeMapIdAndCheeringAtGreaterThanOrderByCheeringAtDesc(lifeMapId, cheeringAt, pageable)
cheererRepository.findByLifeMapIdAndCheeringAtLessThanOrderByCheeringAtDesc(lifeMapId, cheeringAt, pageable)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import java.time.LocalDateTime

interface CheererRepository : JpaRepository<Cheerer, Long> {

fun findByLifeMapIdAndCheeringAtGreaterThanOrderByCheeringAtDesc(lifeMapId: Long, cheeringAt: LocalDateTime, pageable: Pageable): List<Cheerer>
fun findByLifeMapIdAndCheeringAtLessThanOrderByCheeringAtDesc(lifeMapId: Long, cheeringAt: LocalDateTime, pageable: Pageable): List<Cheerer>

fun findByLifeMapIdOrderByCheeringAtDesc(lifeMapId: Long, pageable: Pageable): List<Cheerer>

fun existsByLifeMapIdAndCheeringAtGreaterThanOrderByCheeringAtDesc(lifeMapId: Long, cheeringAt: LocalDateTime): Boolean
fun existsByLifeMapIdAndCheeringAtLessThanOrderByCheeringAtDesc(lifeMapId: Long, cheeringAt: LocalDateTime): Boolean
}

0 comments on commit cb7c465

Please sign in to comment.