Merge pull request '콘텐츠 메인 단편 탭 - 새로운 단편' (#262) from test into main

Reviewed-on: #262
This commit is contained in:
klaus 2025-02-19 08:20:14 +00:00
commit 553c6dc539
8 changed files with 88 additions and 31 deletions

View File

@ -64,7 +64,7 @@ interface AudioContentQueryRepository {
fun findByTheme(
memberId: Long,
theme: String = "",
theme: List<String> = emptyList(),
sortType: SortType = SortType.NEWEST,
isAdult: Boolean = false,
contentType: ContentType,
@ -89,7 +89,7 @@ interface AudioContentQueryRepository {
fun totalCountByTheme(
memberId: Long,
theme: String = "",
theme: List<String> = emptyList(),
isAdult: Boolean = false,
contentType: ContentType
): Int
@ -98,7 +98,7 @@ interface AudioContentQueryRepository {
isFree: Boolean = false,
cloudfrontHost: String,
memberId: Long,
theme: String = "",
theme: List<String> = emptyList(),
isAdult: Boolean = false,
contentType: ContentType,
offset: Long = 0,
@ -107,7 +107,7 @@ interface AudioContentQueryRepository {
fun totalCountNewContentFor2Weeks(
isFree: Boolean = false,
theme: String,
theme: List<String> = emptyList(),
memberId: Long,
isAdult: Boolean,
contentType: ContentType
@ -360,7 +360,7 @@ class AudioContentQueryRepositoryImpl(
override fun findByTheme(
memberId: Long,
theme: String,
theme: List<String>,
sortType: SortType,
isAdult: Boolean,
contentType: ContentType,
@ -406,8 +406,8 @@ class AudioContentQueryRepositoryImpl(
}
}
if (theme.isNotBlank()) {
where = where.and(audioContentTheme.theme.eq(theme))
if (theme.isNotEmpty()) {
where = where.and(audioContentTheme.theme.`in`(theme))
}
if (isFree) {
@ -525,7 +525,12 @@ class AudioContentQueryRepositoryImpl(
.size
}
override fun totalCountByTheme(memberId: Long, theme: String, isAdult: Boolean, contentType: ContentType): Int {
override fun totalCountByTheme(
memberId: Long,
theme: List<String>,
isAdult: Boolean,
contentType: ContentType
): Int {
var where = audioContent.isActive.isTrue
.and(audioContent.duration.isNotNull)
.and(
@ -544,8 +549,8 @@ class AudioContentQueryRepositoryImpl(
}
}
if (theme.isNotBlank()) {
where = where.and(audioContentTheme.theme.eq(theme))
if (theme.isNotEmpty()) {
where = where.and(audioContentTheme.theme.`in`(theme))
}
return queryFactory
@ -560,7 +565,7 @@ class AudioContentQueryRepositoryImpl(
override fun totalCountNewContentFor2Weeks(
isFree: Boolean,
theme: String,
theme: List<String>,
memberId: Long,
isAdult: Boolean,
contentType: ContentType
@ -584,8 +589,8 @@ class AudioContentQueryRepositoryImpl(
}
}
if (theme.isNotBlank()) {
where = where.and(audioContentTheme.theme.eq(theme))
if (theme.isNotEmpty()) {
where = where.and(audioContentTheme.theme.`in`(theme))
}
if (isFree) {
@ -606,7 +611,7 @@ class AudioContentQueryRepositoryImpl(
isFree: Boolean,
cloudfrontHost: String,
memberId: Long,
theme: String,
theme: List<String>,
isAdult: Boolean,
contentType: ContentType,
offset: Long,
@ -631,8 +636,8 @@ class AudioContentQueryRepositoryImpl(
}
}
if (theme.isNotBlank()) {
where = where.and(audioContentTheme.theme.eq(theme))
if (theme.isNotEmpty()) {
where = where.and(audioContentTheme.theme.`in`(theme))
}
if (isFree) {

View File

@ -28,6 +28,17 @@ class AudioContentMainService(
@Cacheable(cacheNames = ["default"], key = "'themeList:' + ':' + #isAdult")
fun getThemeList(isAdult: Boolean): List<String> {
return audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
.filter {
it != "오디오북" &&
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
}
@Transactional(readOnly = true)
@ -40,7 +51,7 @@ class AudioContentMainService(
): List<GetAudioContentMainItem> {
return repository.findByTheme(
memberId = member.id!!,
theme = theme,
theme = listOf(theme),
isAdult = member.auth != null && isAdultContentVisible,
contentType = contentType,
offset = pageable.offset,
@ -57,19 +68,37 @@ class AudioContentMainService(
member: Member,
pageable: Pageable
): GetNewContentAllResponse {
val isAdult = member.auth != null && isAdultContentVisible
val themeList = if (theme.isBlank()) {
audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
.filter {
it != "오디오북" &&
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
} else {
listOf(theme)
}
val totalCount = repository.totalCountNewContentFor2Weeks(
isFree,
theme,
themeList,
memberId = member.id!!,
isAdult = member.auth != null && isAdultContentVisible,
isAdult = isAdult,
contentType = contentType
)
val items = repository.findByThemeFor2Weeks(
isFree,
cloudfrontHost = imageHost,
memberId = member.id!!,
theme = theme,
isAdult = member.auth != null && isAdultContentVisible,
theme = themeList,
isAdult = isAdult,
contentType = contentType,
offset = pageable.offset,
limit = pageable.pageSize.toLong()

View File

@ -35,7 +35,7 @@ class AudioContentMainTabAsmrService(
val newAsmrContentList = contentRepository.findByTheme(
memberId = memberId,
theme = theme,
theme = listOf(theme),
isAdult = isAdult,
contentType = ContentType.ALL,
limit = 10

View File

@ -57,7 +57,7 @@ class AudioContentMainTabContentService(
// 새로운 단편
val newContentList = audioContentRepository.findByTheme(
memberId = member.id!!,
theme = "",
theme = themeOfContentList,
isAdult = member.auth != null,
contentType = ContentType.ALL,
offset = 0,
@ -167,10 +167,29 @@ class AudioContentMainTabContentService(
contentType: ContentType,
member: Member
): List<GetAudioContentMainItem> {
val isAdult = member.auth != null && isAdultContentVisible
val themeList = if (theme.isBlank()) {
audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
.filter {
it != "오디오북" &&
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
} else {
listOf(theme)
}
return audioContentRepository.findByTheme(
memberId = member.id!!,
theme = theme,
isAdult = member.auth != null && isAdultContentVisible,
theme = themeList,
isAdult = isAdult,
contentType = contentType,
offset = 0,
limit = 10

View File

@ -54,7 +54,7 @@ class AudioContentMainTabFreeService(
val recommendSeriesList = recommendSeriesRepository.getRecommendSeriesList(isAdult = isAdult)
val themeList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult)
val themeList = audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, isFree = true)
val newFreeContentList = if (themeList.isNotEmpty()) {
audioContentRepository.findByTheme(
memberId = member.id!!,
@ -137,7 +137,7 @@ class AudioContentMainTabFreeService(
): List<GetAudioContentMainItem> {
return audioContentRepository.findByTheme(
memberId = member.id!!,
theme = theme,
theme = listOf(theme),
isAdult = member.auth != null && isAdultContentVisible,
contentType = contentType,
offset = offset,

View File

@ -35,7 +35,7 @@ class AudioContentMainTabLiveReplayService(
val newLiveReplayContentList = contentRepository.findByTheme(
memberId = memberId,
theme = theme,
theme = listOf(theme),
isAdult = isAdult,
contentType = ContentType.ALL,
limit = 10

View File

@ -27,7 +27,7 @@ class AudioContentThemeQueryRepository(
.fetch()
}
fun getActiveThemeOfContent(isAdult: Boolean = false): List<String> {
fun getActiveThemeOfContent(isAdult: Boolean = false, isFree: Boolean = false): List<String> {
var where = audioContent.isActive.isTrue
.and(audioContentTheme.isActive.isTrue)
@ -35,6 +35,10 @@ class AudioContentThemeQueryRepository(
where = where.and(audioContent.isAdult.isFalse)
}
if (isFree) {
where = where.and(audioContent.price.loe(0))
}
return queryFactory
.select(audioContentTheme.theme)
.from(audioContent)

View File

@ -34,14 +34,14 @@ class AudioContentThemeService(
val totalCount = contentRepository.totalCountByTheme(
memberId = member.id!!,
theme = theme.theme,
theme = listOf(theme.theme),
isAdult = member.auth != null && isAdultContentVisible,
contentType = contentType
)
val items = contentRepository.findByTheme(
memberId = member.id!!,
theme = theme.theme,
theme = listOf(theme.theme),
sortType = sortType,
isAdult = member.auth != null && isAdultContentVisible,
contentType = contentType,