콘텐츠 메인 알람 탭 - 새로운 알람 전체보기

- 전체 개수 추가
This commit is contained in:
Klaus 2025-02-17 20:22:57 +09:00
parent 3344757af8
commit b529d49e78
2 changed files with 50 additions and 3 deletions

View File

@ -81,6 +81,12 @@ interface AudioContentQueryRepository {
limit: Long = 20 limit: Long = 20
): List<GetAudioContentMainItem> ): List<GetAudioContentMainItem>
fun totalAlarmCountByTheme(
memberId: Long,
theme: List<String>,
isAdult: Boolean = false
): Int
fun totalCountByTheme( fun totalCountByTheme(
memberId: Long, memberId: Long,
theme: String = "", theme: String = "",
@ -486,6 +492,39 @@ class AudioContentQueryRepositoryImpl(
.fetch() .fetch()
} }
override fun totalAlarmCountByTheme(memberId: Long, theme: List<String>, isAdult: Boolean): Int {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and(
audioContent.releaseDate.isNull
.or(audioContent.releaseDate.loe(LocalDateTime.now()))
.or(audioContent.member.id.eq(memberId))
)
.and(blockMember.id.isNull)
if (!isAdult) {
where = where.and(audioContent.isAdult.isFalse)
}
if (theme.isNotEmpty()) {
where = where.and(audioContentTheme.theme.`in`(theme))
}
return queryFactory
.select(audioContent.id)
.from(audioContent)
.innerJoin(audioContent.member, member)
.innerJoin(audioContent.theme, audioContentTheme)
.leftJoin(blockMember).on(blockMemberCondition)
.where(where)
.fetch()
.size
}
override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean, contentType: ContentType): Int { override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean, contentType: ContentType): Int {
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull) .and(audioContent.duration.isNotNull)

View File

@ -1,7 +1,7 @@
package kr.co.vividnext.sodalive.content.main.tab.alarm package kr.co.vividnext.sodalive.content.main.tab.alarm
import kr.co.vividnext.sodalive.content.AudioContentRepository import kr.co.vividnext.sodalive.content.AudioContentRepository
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem import kr.co.vividnext.sodalive.content.main.GetNewContentAllResponse
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService
import kr.co.vividnext.sodalive.content.main.curation.AudioContentCurationQueryRepository import kr.co.vividnext.sodalive.content.main.curation.AudioContentCurationQueryRepository
import kr.co.vividnext.sodalive.content.main.tab.GetContentCurationResponse import kr.co.vividnext.sodalive.content.main.tab.GetContentCurationResponse
@ -86,7 +86,7 @@ class AudioContentMainTabAlarmService(
member: Member, member: Member,
offset: Long, offset: Long,
limit: Long limit: Long
): List<GetAudioContentMainItem> { ): GetNewContentAllResponse {
val alarmThemeList = if (theme.isNotBlank()) { val alarmThemeList = if (theme.isNotBlank()) {
listOf(theme) listOf(theme)
} else { } else {
@ -96,12 +96,20 @@ class AudioContentMainTabAlarmService(
val memberId = member.id!! val memberId = member.id!!
val isAdult = member.auth != null val isAdult = member.auth != null
return contentRepository.findAlarmContentByTheme( val totalCount = contentRepository.totalAlarmCountByTheme(
memberId = memberId,
theme = alarmThemeList,
isAdult = isAdult
)
val items = contentRepository.findAlarmContentByTheme(
memberId = memberId, memberId = memberId,
theme = alarmThemeList, theme = alarmThemeList,
isAdult = isAdult, isAdult = isAdult,
offset = offset, offset = offset,
limit = limit limit = limit
) )
return GetNewContentAllResponse(totalCount, items)
} }
} }