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