test #358

Merged
klaus merged 4 commits from test into main 2025-11-10 06:53:41 +00:00
3 changed files with 17 additions and 6 deletions
Showing only changes of commit eab7dc4521 - Show all commits

View File

@@ -165,7 +165,8 @@ class HomeService(
),
contentType = contentType,
isFree = true,
isAdult = isAdult
isAdult = isAdult,
orderByRandom = true
).filter {
if (memberId != null) {
!memberService.isBlocked(blockedMemberId = memberId, memberId = it.creatorId)

View File

@@ -183,7 +183,8 @@ interface AudioContentQueryRepository {
offset: Long,
limit: Long,
isFree: Boolean,
isAdult: Boolean
isAdult: Boolean,
orderByRandom: Boolean = false
): List<AudioContentMainItem>
fun findContentByCurationId(
@@ -1308,7 +1309,8 @@ class AudioContentQueryRepositoryImpl(
offset: Long,
limit: Long,
isFree: Boolean,
isAdult: Boolean
isAdult: Boolean,
orderByRandom: Boolean
): List<AudioContentMainItem> {
var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
@@ -1343,6 +1345,12 @@ class AudioContentQueryRepositoryImpl(
where = where.and(audioContent.price.loe(0))
}
val orderBy = if (orderByRandom) {
Expressions.numberTemplate(Double::class.java, "function('rand')").asc()
} else {
audioContent.releaseDate.desc()
}
return queryFactory
.select(
QAudioContentMainItem(
@@ -1360,7 +1368,7 @@ class AudioContentQueryRepositoryImpl(
.where(where)
.offset(offset)
.limit(limit)
.orderBy(audioContent.releaseDate.desc())
.orderBy(orderBy)
.fetch()
}

View File

@@ -989,7 +989,8 @@ class AudioContentService(
offset: Long = 0,
limit: Long = 20,
isFree: Boolean = false,
isAdult: Boolean = false
isAdult: Boolean = false,
orderByRandom: Boolean = false
): List<AudioContentMainItem> {
return repository.getLatestContentByTheme(
theme = theme,
@@ -997,7 +998,8 @@ class AudioContentService(
offset = offset,
limit = limit,
isFree = isFree,
isAdult = isAdult
isAdult = isAdult,
orderByRandom = orderByRandom
)
}
}