Merge pull request 'test' (#136) from test into main

Reviewed-on: #136
This commit is contained in:
klaus 2024-02-27 16:16:30 +00:00
commit a999dd2085
2 changed files with 9 additions and 2 deletions

View File

@ -166,6 +166,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
var where = audioContent.member.id.eq(creatorId) var where = audioContent.member.id.eq(creatorId)
.and( .and(
audioContent.isActive.isTrue audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull)) .or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull))
) )
@ -237,6 +238,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
var where = audioContent.member.id.eq(creatorId) var where = audioContent.member.id.eq(creatorId)
.and( .and(
audioContent.isActive.isTrue audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull)) .or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull))
) )
@ -336,6 +338,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
} }
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and( .and(
audioContent.releaseDate.isNull audioContent.releaseDate.isNull
.or(audioContent.releaseDate.loe(LocalDateTime.now())) .or(audioContent.releaseDate.loe(LocalDateTime.now()))
@ -375,6 +378,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean): Int { override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean): Int {
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and( .and(
audioContent.releaseDate.isNull audioContent.releaseDate.isNull
.or(audioContent.releaseDate.loe(LocalDateTime.now())) .or(audioContent.releaseDate.loe(LocalDateTime.now()))
@ -401,6 +405,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
override fun totalCountNewContentFor2Weeks(theme: String, memberId: Long, isAdult: Boolean): Int { override fun totalCountNewContentFor2Weeks(theme: String, memberId: Long, isAdult: Boolean): Int {
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and(audioContent.releaseDate.goe(LocalDateTime.now().minusWeeks(2))) .and(audioContent.releaseDate.goe(LocalDateTime.now().minusWeeks(2)))
.and( .and(
audioContent.releaseDate.isNull audioContent.releaseDate.isNull
@ -435,6 +440,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
limit: Long limit: Long
): List<GetAudioContentMainItem> { ): List<GetAudioContentMainItem> {
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and(audioContent.releaseDate.goe(LocalDateTime.now().minusWeeks(2))) .and(audioContent.releaseDate.goe(LocalDateTime.now().minusWeeks(2)))
.and( .and(
audioContent.releaseDate.isNull audioContent.releaseDate.isNull
@ -479,6 +485,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
): List<GetNewContentUploadCreator> { ): List<GetNewContentUploadCreator> {
var where = audioContent.releaseDate.after(LocalDateTime.now().minusWeeks(2)) var where = audioContent.releaseDate.after(LocalDateTime.now().minusWeeks(2))
.and(audioContent.isActive.isTrue) .and(audioContent.isActive.isTrue)
.and(audioContent.duration.isNotNull)
if (!isAdult) { if (!isAdult) {
where = where.and(audioContent.isAdult.isFalse) where = where.and(audioContent.isAdult.isFalse)

View File

@ -54,9 +54,9 @@ class NewRouletteService(
oldRepository.deleteById(roulette.creatorId) oldRepository.deleteById(roulette.creatorId)
} }
} }
rouletteList.sortedBy { it.id }
return rouletteList.asSequence() return rouletteList.sortedWith(compareByDescending<NewRoulette> { it.isActive }.thenBy { it.id })
.asSequence()
.map { .map {
GetNewRouletteResponse( GetNewRouletteResponse(
it.id, it.id,