콘텐츠 랭킹 데이터 전체보기 API - 페이징 추가
This commit is contained in:
parent
9146e2e231
commit
149a3ad2f1
|
@ -151,10 +151,17 @@ class AudioContentController(private val service: AudioContentService) {
|
|||
|
||||
@GetMapping("/ranking")
|
||||
fun getAudioContentRanking(
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(service.getAudioContentRanking(member = member))
|
||||
ApiResponse.ok(
|
||||
service.getAudioContentRanking(
|
||||
member = member,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ interface AudioContentQueryRepository {
|
|||
isAdult: Boolean,
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime,
|
||||
offset: Long = 0,
|
||||
limit: Long = 12
|
||||
): List<GetAudioContentRankingItem>
|
||||
}
|
||||
|
@ -442,6 +443,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
isAdult: Boolean,
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<GetAudioContentRankingItem> {
|
||||
var where = audioContent.isActive.isTrue
|
||||
|
|
|
@ -577,7 +577,11 @@ class AudioContentService(
|
|||
}
|
||||
}
|
||||
|
||||
fun getAudioContentRanking(member: Member): GetAudioContentRanking {
|
||||
fun getAudioContentRanking(
|
||||
member: Member,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): GetAudioContentRanking {
|
||||
val currentDateTime = LocalDateTime.now()
|
||||
val startDate = currentDateTime
|
||||
.withHour(15)
|
||||
|
@ -597,7 +601,8 @@ class AudioContentService(
|
|||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
isAdult = member.auth != null,
|
||||
limit = 50
|
||||
offset = offset,
|
||||
limit = limit
|
||||
)
|
||||
|
||||
return GetAudioContentRanking(
|
||||
|
|
Loading…
Reference in New Issue