parent
e1bfd944e9
commit
713d42a674
|
@ -81,6 +81,7 @@ interface AudioContentQueryRepository {
|
|||
): Int
|
||||
|
||||
fun findByThemeFor2Weeks(
|
||||
isFree: Boolean = false,
|
||||
cloudfrontHost: String,
|
||||
memberId: Long,
|
||||
theme: String = "",
|
||||
|
@ -91,6 +92,7 @@ interface AudioContentQueryRepository {
|
|||
): List<GetAudioContentMainItem>
|
||||
|
||||
fun totalCountNewContentFor2Weeks(
|
||||
isFree: Boolean = false,
|
||||
theme: String,
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
|
@ -456,6 +458,7 @@ class AudioContentQueryRepositoryImpl(
|
|||
}
|
||||
|
||||
override fun totalCountNewContentFor2Weeks(
|
||||
isFree: Boolean,
|
||||
theme: String,
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
|
@ -484,6 +487,10 @@ class AudioContentQueryRepositoryImpl(
|
|||
where = where.and(audioContentTheme.theme.eq(theme))
|
||||
}
|
||||
|
||||
if (isFree) {
|
||||
where = where.and(audioContent.price.loe(0))
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(audioContent.id)
|
||||
.from(audioContent)
|
||||
|
@ -495,6 +502,7 @@ class AudioContentQueryRepositoryImpl(
|
|||
}
|
||||
|
||||
override fun findByThemeFor2Weeks(
|
||||
isFree: Boolean,
|
||||
cloudfrontHost: String,
|
||||
memberId: Long,
|
||||
theme: String,
|
||||
|
@ -526,6 +534,10 @@ class AudioContentQueryRepositoryImpl(
|
|||
where = where.and(audioContentTheme.theme.eq(theme))
|
||||
}
|
||||
|
||||
if (isFree) {
|
||||
where = where.and(audioContent.price.loe(0))
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
QGetAudioContentMainItem(
|
||||
|
|
|
@ -92,6 +92,7 @@ class AudioContentMainController(
|
|||
|
||||
@GetMapping("/new/all")
|
||||
fun getNewContentAllByTheme(
|
||||
@RequestParam("isFree", required = false) isFree: Boolean? = null,
|
||||
@RequestParam("theme") theme: String,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
|
@ -102,6 +103,7 @@ class AudioContentMainController(
|
|||
|
||||
ApiResponse.ok(
|
||||
service.getNewContentFor2WeeksByTheme(
|
||||
isFree = isFree ?: false,
|
||||
theme = theme,
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
|
|
|
@ -50,6 +50,7 @@ class AudioContentMainService(
|
|||
|
||||
@Transactional(readOnly = true)
|
||||
fun getNewContentFor2WeeksByTheme(
|
||||
isFree: Boolean,
|
||||
theme: String,
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
|
@ -57,12 +58,14 @@ class AudioContentMainService(
|
|||
pageable: Pageable
|
||||
): GetNewContentAllResponse {
|
||||
val totalCount = repository.totalCountNewContentFor2Weeks(
|
||||
isFree,
|
||||
theme,
|
||||
memberId = member.id!!,
|
||||
isAdult = member.auth != null && isAdultContentVisible,
|
||||
contentType = contentType
|
||||
)
|
||||
val items = repository.findByThemeFor2Weeks(
|
||||
isFree,
|
||||
cloudfrontHost = imageHost,
|
||||
memberId = member.id!!,
|
||||
theme = theme,
|
||||
|
|
Loading…
Reference in New Issue