Compare commits

...

27 Commits

Author SHA1 Message Date
587f3d6b58 Merge pull request 'test' (#368) from test into main
Reviewed-on: #368
2025-11-20 16:02:25 +00:00
76806e2e90 feat(content-theme): 무료 콘텐츠의 테마를 조회할 때 '자기소개'가 가장 먼저 표시되도록 수정 2025-11-21 00:49:17 +09:00
39c51825da feat(content-theme): 무료 콘텐츠의 테마를 조회할 때 '자기소개'가 가장 먼저 표시되도록 수정 2025-11-21 00:37:29 +09:00
9b6167d46d Merge pull request 'test' (#367) from test into main
Reviewed-on: #367
2025-11-20 12:53:00 +00:00
9a58b7b95f feat(latest-content-by-creator): 최신 콘텐츠 1개 조회시 오픈 되어 있는 콘텐츠만 조회하도록 수정 2025-11-20 21:19:29 +09:00
26eae4b06e feat(latest-content-by-creator): 최신 콘텐츠 1개 조회시 오픈 되어 있는 콘텐츠만 조회하도록 수정 2025-11-20 20:59:09 +09:00
008ee3b4e5 Merge pull request 'test' (#366) from test into main
Reviewed-on: #366
2025-11-20 06:27:02 +00:00
60989391f6 feat(content-sort-type): 콘텐츠가 있는 active 테마 조회 API 추가 2025-11-20 00:51:09 +09:00
88d90eec2f feat(content-sort-type): getLatestContentByTheme(테마별 콘텐츠 조회)시 정렬 타입 추가 2025-11-20 00:26:24 +09:00
b6eb13df06 feat(content-sort-type): 콘텐츠 정렬 타입 인기순(POPULARITY) 추가 2025-11-20 00:05:33 +09:00
3a57ad23bb Merge pull request 'test' (#365) from test into main
Reviewed-on: #365
2025-11-19 08:56:28 +00:00
a6b815ad05 fix(series-main): 완료 시리즈 랜덤 정렬 2025-11-19 17:48:07 +09:00
d89122802a fix(series): 시리즈 리스트 랜덤 정렬로 조회할 수 있도록 기능 추가 2025-11-19 17:45:46 +09:00
729552335a Merge pull request 'test' (#364) from test into main
Reviewed-on: #364
2025-11-18 10:38:50 +00:00
690432d6ee fix(latest-content): 최신 콘텐츠 전체보기에서 유/무료 모두 조회되도록 수정 2025-11-18 19:21:15 +09:00
bc358d18de fix(latest-content): 최신 콘텐츠 전체보기에서 사용하는 theme에서 제외하는 theme 없이 모두 조회하도록 수정 2025-11-18 18:56:09 +09:00
02ae507c87 Merge pull request 'fix(series-list): 시리즈 리스트 조회시 정렬 수정' (#363) from test into main
Reviewed-on: #363
2025-11-17 13:38:59 +00:00
add88aca35 fix(series-list): 시리즈 리스트 조회시 정렬 수정 2025-11-17 22:24:01 +09:00
5818abf69d Merge pull request 'fix(series-list): creator의 시리즈를 볼 떄와 다른 페이지에서 시리즈 리스트를 볼 때 정렬 순서 분리' (#362) from test into main
Reviewed-on: #362
2025-11-17 12:25:38 +00:00
b6971f6a8d fix(series-list): creator의 시리즈를 볼 떄와 다른 페이지에서 시리즈 리스트를 볼 때 정렬 순서 분리 2025-11-17 21:13:52 +09:00
ee403915f0 Merge pull request 'test' (#361) from test into main
Reviewed-on: #361
2025-11-17 07:13:11 +00:00
f83dd47c7c fix(security-config): 홈 > 콘텐츠 랭킹을 로그인 하지 않아도 조회가 가능하도록 수정 2025-11-17 15:58:23 +09:00
146f733f5d feat(chat-character): 추천 캐릭터 개수 20 -> 30개로 변경 2025-11-17 15:50:40 +09:00
806fcfe7db feat(home): 추천 콘텐츠 개수 20 -> 30개로 변경 2025-11-17 15:49:06 +09:00
1a660088de Merge pull request 'test' (#360) from test into main
Reviewed-on: #360
2025-11-13 20:49:12 +00:00
04e7c90407 fix(character): isNew -> new로 변경 2025-11-14 05:39:56 +09:00
f278497526 fix(character): isNew -> new로 변경 2025-11-14 05:37:24 +09:00
19 changed files with 122 additions and 63 deletions

View File

@@ -51,7 +51,7 @@ class HomeService(
private val imageHost: String private val imageHost: String
) { ) {
companion object { companion object {
private const val RECOMMEND_TARGET_SIZE = 20 private const val RECOMMEND_TARGET_SIZE = 30
private const val RECOMMEND_MAX_ATTEMPTS = 3 private const val RECOMMEND_MAX_ATTEMPTS = 3
} }
@@ -124,7 +124,8 @@ class HomeService(
val originalAudioDramaList = seriesService.getOriginalAudioDramaList( val originalAudioDramaList = seriesService.getOriginalAudioDramaList(
isAdult = isAdult, isAdult = isAdult,
contentType = contentType contentType = contentType,
orderByRandom = true
) )
val auditionList = auditionService.getInProgressAuditionList(isAdult = isAdult) val auditionList = auditionService.getInProgressAuditionList(isAdult = isAdult)

View File

@@ -75,11 +75,11 @@ class ChatCharacterController(
).content ).content
// 추천 캐릭터 조회 // 추천 캐릭터 조회
// 최근 대화한 캐릭터를 제외한 랜덤 20개 조회 // 최근 대화한 캐릭터를 제외한 랜덤 30개 조회
// Controller에서는 호출만 // Controller에서는 호출만
// 세부로직은 추후에 변경될 수 있으므로 Service에 별도로 생성 // 세부로직은 추후에 변경될 수 있으므로 Service에 별도로 생성
val excludeIds = recentCharacters.map { it.characterId } val excludeIds = recentCharacters.map { it.characterId }
val recommendCharacters = service.getRecommendCharacters(excludeIds, 20) val recommendCharacters = service.getRecommendCharacters(excludeIds, 30)
// 큐레이션 섹션 (활성화된 큐레이션 + 캐릭터) // 큐레이션 섹션 (활성화된 큐레이션 + 캐릭터)
val curationSections = curationQueryService.getActiveCurationsWithCharacters() val curationSections = curationQueryService.getActiveCurationsWithCharacters()
@@ -93,7 +93,7 @@ class ChatCharacterController(
name = it.name, name = it.name,
description = it.description, description = it.description,
imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}", imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}",
isNew = false new = false
) )
} }
) )

View File

@@ -22,7 +22,7 @@ data class Character(
@JsonProperty("name") val name: String, @JsonProperty("name") val name: String,
@JsonProperty("description") val description: String, @JsonProperty("description") val description: String,
@JsonProperty("imageUrl") val imageUrl: String, @JsonProperty("imageUrl") val imageUrl: String,
@JsonProperty("isNew") val isNew: Boolean @JsonProperty("isNew") val new: Boolean
) )
data class RecentCharacter( data class RecentCharacter(

View File

@@ -66,7 +66,7 @@ class ChatCharacterService(
name = it.name, name = it.name,
description = it.description, description = it.description,
imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}", imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}",
isNew = recentSet.contains(it.id) new = recentSet.contains(it.id)
) )
} }
} }
@@ -102,7 +102,7 @@ class ChatCharacterService(
name = it.name, name = it.name,
description = it.description, description = it.description,
imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}", imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}",
isNew = recentSet.contains(it.id) new = recentSet.contains(it.id)
) )
} }
} }
@@ -158,7 +158,7 @@ class ChatCharacterService(
name = it.name, name = it.name,
description = it.description, description = it.description,
imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}", imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}",
isNew = recentSet.contains(it.id) new = recentSet.contains(it.id)
) )
} }
return RecentCharactersResponse( return RecentCharactersResponse(
@@ -189,7 +189,7 @@ class ChatCharacterService(
name = it.name, name = it.name,
description = it.description, description = it.description,
imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}", imageUrl = "$imageHost/${it.imagePath ?: "profile/default-profile.png"}",
isNew = recentSet.contains(it.id) new = recentSet.contains(it.id)
) )
} }

View File

@@ -94,7 +94,7 @@ class OriginalWorkController(
name = it.name, name = it.name,
description = it.description, description = it.description,
imageUrl = "$imageHost/$path", imageUrl = "$imageHost/$path",
isNew = recentSet.contains(it.id) new = recentSet.contains(it.id)
) )
} }
) )

View File

@@ -83,6 +83,7 @@ class SecurityConfig(
.antMatchers("/api/home").permitAll() .antMatchers("/api/home").permitAll()
.antMatchers("/api/home/latest-content").permitAll() .antMatchers("/api/home/latest-content").permitAll()
.antMatchers("/api/home/day-of-week-series").permitAll() .antMatchers("/api/home/day-of-week-series").permitAll()
.antMatchers("/api/home/content-ranking").permitAll()
.antMatchers(HttpMethod.GET, "/api/live").permitAll() .antMatchers(HttpMethod.GET, "/api/live").permitAll()
.antMatchers(HttpMethod.GET, "/faq").permitAll() .antMatchers(HttpMethod.GET, "/faq").permitAll()
.antMatchers(HttpMethod.GET, "/faq/category").permitAll() .antMatchers(HttpMethod.GET, "/faq/category").permitAll()

View File

@@ -23,7 +23,7 @@ enum class PurchaseOption {
} }
enum class SortType { enum class SortType {
NEWEST, PRICE_HIGH, PRICE_LOW NEWEST, PRICE_HIGH, PRICE_LOW, POPULARITY
} }
@Entity @Entity

View File

@@ -243,6 +243,8 @@ class AudioContentController(private val service: AudioContentService) {
@RequestParam("contentType", required = false) contentType: ContentType? = null, @RequestParam("contentType", required = false) contentType: ContentType? = null,
@RequestParam("isFree", required = false) isFree: Boolean? = null, @RequestParam("isFree", required = false) isFree: Boolean? = null,
@RequestParam("isPointAvailableOnly", required = false) isPointAvailableOnly: Boolean? = null, @RequestParam("isPointAvailableOnly", required = false) isPointAvailableOnly: Boolean? = null,
@RequestParam("sort-type", required = false) sortType: SortType? = SortType.NEWEST,
@RequestParam("theme", required = false) theme: String? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
pageable: Pageable pageable: Pageable
) = run { ) = run {
@@ -250,10 +252,11 @@ class AudioContentController(private val service: AudioContentService) {
ApiResponse.ok( ApiResponse.ok(
service.getLatestContentByTheme( service.getLatestContentByTheme(
theme = emptyList(), theme = if (theme == null) listOf() else listOf(theme),
contentType = contentType ?: ContentType.ALL, contentType = contentType ?: ContentType.ALL,
offset = pageable.offset, offset = pageable.offset,
limit = pageable.pageSize.toLong(), limit = pageable.pageSize.toLong(),
sortType = sortType ?: SortType.NEWEST,
isFree = isFree ?: false, isFree = isFree ?: false,
isAdult = (isAdultContentVisible ?: true) && member.auth != null, isAdult = (isAdultContentVisible ?: true) && member.auth != null,
isPointAvailableOnly = isPointAvailableOnly ?: false isPointAvailableOnly = isPointAvailableOnly ?: false

View File

@@ -109,7 +109,6 @@ interface AudioContentQueryRepository {
): Int ): Int
fun findByThemeFor2Weeks( fun findByThemeFor2Weeks(
isFree: Boolean = false,
cloudfrontHost: String, cloudfrontHost: String,
memberId: Long, memberId: Long,
theme: List<String> = emptyList(), theme: List<String> = emptyList(),
@@ -120,7 +119,6 @@ interface AudioContentQueryRepository {
): List<GetAudioContentMainItem> ): List<GetAudioContentMainItem>
fun totalCountNewContentFor2Weeks( fun totalCountNewContentFor2Weeks(
isFree: Boolean = false,
theme: List<String> = emptyList(), theme: List<String> = emptyList(),
memberId: Long, memberId: Long,
isAdult: Boolean, isAdult: Boolean,
@@ -182,6 +180,7 @@ interface AudioContentQueryRepository {
contentType: ContentType, contentType: ContentType,
offset: Long, offset: Long,
limit: Long, limit: Long,
sortType: SortType,
isFree: Boolean, isFree: Boolean,
isAdult: Boolean, isAdult: Boolean,
orderByRandom: Boolean = false, orderByRandom: Boolean = false,
@@ -243,6 +242,7 @@ class AudioContentQueryRepositoryImpl(
SortType.NEWEST -> audioContent.releaseDate.desc() SortType.NEWEST -> audioContent.releaseDate.desc()
SortType.PRICE_HIGH -> audioContent.price.desc() SortType.PRICE_HIGH -> audioContent.price.desc()
SortType.PRICE_LOW -> audioContent.price.asc() SortType.PRICE_LOW -> audioContent.price.asc()
SortType.POPULARITY -> audioContent.playCount.desc()
} }
var where = audioContent.member.id.eq(creatorId) var where = audioContent.member.id.eq(creatorId)
@@ -464,6 +464,12 @@ class AudioContentQueryRepositoryImpl(
audioContent.releaseDate.asc(), audioContent.releaseDate.asc(),
audioContent.id.asc() audioContent.id.asc()
) )
SortType.POPULARITY -> listOf(
audioContent.playCount.desc(),
audioContent.releaseDate.asc(),
audioContent.id.asc()
)
} }
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
@@ -695,7 +701,6 @@ class AudioContentQueryRepositoryImpl(
} }
override fun totalCountNewContentFor2Weeks( override fun totalCountNewContentFor2Weeks(
isFree: Boolean,
theme: List<String>, theme: List<String>,
memberId: Long, memberId: Long,
isAdult: Boolean, isAdult: Boolean,
@@ -732,10 +737,6 @@ class AudioContentQueryRepositoryImpl(
where = where.and(audioContentTheme.theme.`in`(theme)) where = where.and(audioContentTheme.theme.`in`(theme))
} }
if (isFree) {
where = where.and(audioContent.price.loe(0))
}
return queryFactory return queryFactory
.select(audioContent.id) .select(audioContent.id)
.from(audioContent) .from(audioContent)
@@ -747,7 +748,6 @@ class AudioContentQueryRepositoryImpl(
} }
override fun findByThemeFor2Weeks( override fun findByThemeFor2Weeks(
isFree: Boolean,
cloudfrontHost: String, cloudfrontHost: String,
memberId: Long, memberId: Long,
theme: List<String>, theme: List<String>,
@@ -787,10 +787,6 @@ class AudioContentQueryRepositoryImpl(
where = where.and(audioContentTheme.theme.`in`(theme)) where = where.and(audioContentTheme.theme.`in`(theme))
} }
if (isFree) {
where = where.and(audioContent.price.loe(0))
}
return queryFactory return queryFactory
.select( .select(
QGetAudioContentMainItem( QGetAudioContentMainItem(
@@ -1309,6 +1305,7 @@ class AudioContentQueryRepositoryImpl(
contentType: ContentType, contentType: ContentType,
offset: Long, offset: Long,
limit: Long, limit: Long,
sortType: SortType,
isFree: Boolean, isFree: Boolean,
isAdult: Boolean, isAdult: Boolean,
orderByRandom: Boolean, orderByRandom: Boolean,
@@ -1354,7 +1351,22 @@ class AudioContentQueryRepositoryImpl(
val orderBy = if (orderByRandom) { val orderBy = if (orderByRandom) {
Expressions.numberTemplate(Double::class.java, "function('rand')").asc() Expressions.numberTemplate(Double::class.java, "function('rand')").asc()
} else { } else {
audioContent.releaseDate.desc() when (sortType) {
SortType.NEWEST -> audioContent.releaseDate.desc()
SortType.PRICE_HIGH -> if (isFree) {
audioContent.releaseDate.desc()
} else {
audioContent.price.desc()
}
SortType.PRICE_LOW -> if (isFree) {
audioContent.releaseDate.asc()
} else {
audioContent.price.desc()
}
SortType.POPULARITY -> audioContent.playCount.desc()
}
} }
return queryFactory return queryFactory
@@ -1441,11 +1453,10 @@ class AudioContentQueryRepositoryImpl(
isAdult: Boolean isAdult: Boolean
): AudioContent? { ): AudioContent? {
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)
.and(audioContent.duration.isNotNull) .and(audioContent.releaseDate.isNotNull)
.or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull)) .and(audioContent.releaseDate.loe(LocalDateTime.now()))
)
if (!isAdult) { if (!isAdult) {
where = where.and(audioContent.isAdult.isFalse) where = where.and(audioContent.isAdult.isFalse)

View File

@@ -988,6 +988,7 @@ class AudioContentService(
contentType: ContentType, contentType: ContentType,
offset: Long = 0, offset: Long = 0,
limit: Long = 20, limit: Long = 20,
sortType: SortType = SortType.NEWEST,
isFree: Boolean = false, isFree: Boolean = false,
isAdult: Boolean = false, isAdult: Boolean = false,
orderByRandom: Boolean = false, orderByRandom: Boolean = false,
@@ -998,6 +999,7 @@ class AudioContentService(
contentType = contentType, contentType = contentType,
offset = offset, offset = offset,
limit = limit, limit = limit,
sortType = sortType,
isFree = isFree, isFree = isFree,
isAdult = isAdult, isAdult = isAdult,
orderByRandom = orderByRandom, orderByRandom = orderByRandom,

View File

@@ -99,7 +99,6 @@ class AudioContentMainController(
@GetMapping("/new/all") @GetMapping("/new/all")
fun getNewContentAllByTheme( fun getNewContentAllByTheme(
@RequestParam("isFree", required = false) isFree: Boolean? = null,
@RequestParam("theme") theme: String, @RequestParam("theme") theme: String,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null, @RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null, @RequestParam("contentType", required = false) contentType: ContentType? = null,
@@ -110,7 +109,6 @@ class AudioContentMainController(
ApiResponse.ok( ApiResponse.ok(
service.getNewContentFor2WeeksByTheme( service.getNewContentFor2WeeksByTheme(
isFree = isFree ?: false,
theme = theme, theme = theme,
isAdultContentVisible = isAdultContentVisible ?: true, isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL, contentType = contentType ?: ContentType.ALL,

View File

@@ -28,16 +28,6 @@ class AudioContentMainService(
@Cacheable(cacheNames = ["default"], key = "'themeList:' + ':' + #isAdult") @Cacheable(cacheNames = ["default"], key = "'themeList:' + ':' + #isAdult")
fun getThemeList(isAdult: Boolean, contentType: ContentType): List<String> { fun getThemeList(isAdult: Boolean, contentType: ContentType): List<String> {
return audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, contentType = contentType) return audioContentThemeRepository.getActiveThemeOfContent(isAdult = isAdult, contentType = contentType)
.filter {
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
@@ -64,7 +54,6 @@ class AudioContentMainService(
@Transactional(readOnly = true) @Transactional(readOnly = true)
fun getNewContentFor2WeeksByTheme( fun getNewContentFor2WeeksByTheme(
isFree: Boolean,
theme: String, theme: String,
isAdultContentVisible: Boolean, isAdultContentVisible: Boolean,
contentType: ContentType, contentType: ContentType,
@@ -75,31 +64,19 @@ class AudioContentMainService(
val themeList = if (theme.isBlank()) { val themeList = if (theme.isBlank()) {
audioContentThemeRepository.getActiveThemeOfContent( audioContentThemeRepository.getActiveThemeOfContent(
isAdult = isAdult, isAdult = isAdult,
isFree = isFree,
contentType = contentType contentType = contentType
).filter { )
it != "모닝콜" &&
it != "알람" &&
it != "슬립콜" &&
it != "다시듣기" &&
it != "ASMR" &&
it != "릴레이" &&
it != "챌린지" &&
it != "자기소개"
}
} else { } else {
listOf(theme) listOf(theme)
} }
val totalCount = repository.totalCountNewContentFor2Weeks( val totalCount = repository.totalCountNewContentFor2Weeks(
isFree,
themeList, themeList,
memberId = member.id!!, memberId = member.id!!,
isAdult = isAdult, isAdult = isAdult,
contentType = contentType contentType = contentType
) )
val items = repository.findByThemeFor2Weeks( val items = repository.findByThemeFor2Weeks(
isFree,
cloudfrontHost = imageHost, cloudfrontHost = imageHost,
memberId = member.id!!, memberId = member.id!!,
theme = themeList, theme = themeList,

View File

@@ -58,6 +58,7 @@ class AudioContentCurationQueryRepository(private val queryFactory: JPAQueryFact
SortType.NEWEST -> audioContent.createdAt.desc() SortType.NEWEST -> audioContent.createdAt.desc()
SortType.PRICE_HIGH -> audioContent.price.desc() SortType.PRICE_HIGH -> audioContent.price.desc()
SortType.PRICE_LOW -> audioContent.price.asc() SortType.PRICE_LOW -> audioContent.price.asc()
SortType.POPULARITY -> audioContent.playCount.desc()
} }
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue

View File

@@ -39,6 +39,7 @@ interface ContentSeriesQueryRepository {
contentType: ContentType, contentType: ContentType,
isOriginal: Boolean, isOriginal: Boolean,
isCompleted: Boolean, isCompleted: Boolean,
orderByRandom: Boolean,
offset: Long, offset: Long,
limit: Long limit: Long
): List<Series> ): List<Series>
@@ -65,6 +66,7 @@ interface ContentSeriesQueryRepository {
fun getOriginalAudioDramaList( fun getOriginalAudioDramaList(
isAdult: Boolean, isAdult: Boolean,
contentType: ContentType, contentType: ContentType,
orderByRandom: Boolean = false,
offset: Long = 0, offset: Long = 0,
limit: Long = 20 limit: Long = 20
): List<Series> ): List<Series>
@@ -139,6 +141,7 @@ class ContentSeriesQueryRepositoryImpl(
contentType: ContentType, contentType: ContentType,
isOriginal: Boolean, isOriginal: Boolean,
isCompleted: Boolean, isCompleted: Boolean,
orderByRandom: Boolean,
offset: Long, offset: Long,
limit: Long limit: Long
): List<Series> { ): List<Series> {
@@ -173,11 +176,22 @@ class ContentSeriesQueryRepositoryImpl(
} }
} }
val orderBy = if (orderByRandom) {
listOf(Expressions.numberTemplate(Double::class.java, "function('rand')").asc())
} else if (creatorId != null) {
listOf(series.orders.asc(), series.createdAt.asc())
} else {
listOf(audioContent.releaseDate.max().desc(), series.createdAt.asc())
}
return queryFactory return queryFactory
.selectFrom(series) .selectFrom(series)
.innerJoin(series.member, member) .innerJoin(series.member, member)
.innerJoin(seriesContent).on(series.id.eq(seriesContent.series.id))
.innerJoin(seriesContent.content, audioContent)
.where(where) .where(where)
.orderBy(series.orders.asc(), series.createdAt.asc()) .groupBy(series.id)
.orderBy(*orderBy.toTypedArray())
.offset(offset) .offset(offset)
.limit(limit) .limit(limit)
.fetch() .fetch()
@@ -353,6 +367,7 @@ class ContentSeriesQueryRepositoryImpl(
override fun getOriginalAudioDramaList( override fun getOriginalAudioDramaList(
isAdult: Boolean, isAdult: Boolean,
contentType: ContentType, contentType: ContentType,
orderByRandom: Boolean,
offset: Long, offset: Long,
limit: Long limit: Long
): List<Series> { ): List<Series> {
@@ -381,7 +396,13 @@ class ContentSeriesQueryRepositoryImpl(
.selectFrom(series) .selectFrom(series)
.innerJoin(series.member, member) .innerJoin(series.member, member)
.where(where) .where(where)
.orderBy(series.id.desc()) .orderBy(
if (orderByRandom) {
Expressions.numberTemplate(Double::class.java, "function('rand')").asc()
} else {
series.id.desc()
}
)
.offset(offset) .offset(offset)
.limit(limit) .limit(limit)
.fetch() .fetch()

View File

@@ -37,10 +37,11 @@ class ContentSeriesService(
fun getOriginalAudioDramaList( fun getOriginalAudioDramaList(
isAdult: Boolean, isAdult: Boolean,
contentType: ContentType, contentType: ContentType,
orderByRandom: Boolean = false,
offset: Long = 0, offset: Long = 0,
limit: Long = 20 limit: Long = 20
): List<GetSeriesListResponse.SeriesListItem> { ): List<GetSeriesListResponse.SeriesListItem> {
val originalAudioDramaList = repository.getOriginalAudioDramaList(isAdult, contentType, offset, limit) val originalAudioDramaList = repository.getOriginalAudioDramaList(isAdult, contentType, orderByRandom, offset, limit)
return seriesToSeriesListItem(originalAudioDramaList, isAdult, contentType) return seriesToSeriesListItem(originalAudioDramaList, isAdult, contentType)
} }
@@ -52,6 +53,7 @@ class ContentSeriesService(
creatorId: Long?, creatorId: Long?,
isOriginal: Boolean = false, isOriginal: Boolean = false,
isCompleted: Boolean = false, isCompleted: Boolean = false,
orderByRandom: Boolean = false,
isAdultContentVisible: Boolean, isAdultContentVisible: Boolean,
contentType: ContentType, contentType: ContentType,
member: Member, member: Member,
@@ -75,6 +77,7 @@ class ContentSeriesService(
contentType = contentType, contentType = contentType,
isOriginal = isOriginal, isOriginal = isOriginal,
isCompleted = isCompleted, isCompleted = isCompleted,
orderByRandom = orderByRandom,
offset = offset, offset = offset,
limit = limit limit = limit
).filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) } ).filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) }

View File

@@ -42,6 +42,7 @@ class SeriesMainController(
val completedSeriesList = contentSeriesService.getSeriesList( val completedSeriesList = contentSeriesService.getSeriesList(
creatorId = null, creatorId = null,
isCompleted = true, isCompleted = true,
orderByRandom = true,
isAdultContentVisible = isAdultContentVisible ?: true, isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL, contentType = contentType ?: ContentType.ALL,
member = member member = member

View File

@@ -27,6 +27,26 @@ class AudioContentThemeController(private val service: AudioContentThemeService)
ApiResponse.ok(service.getThemes()) ApiResponse.ok(service.getThemes())
} }
@GetMapping("/active")
fun getActiveThemes(
@RequestParam("isFree", required = false) isFree: Boolean? = null,
@RequestParam("isPointAvailableOnly", required = false) isPointAvailableOnly: Boolean? = null,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(
service.getActiveThemeOfContent(
isAdult = member.auth != null && (isAdultContentVisible ?: true),
isFree = isFree ?: false,
isPointAvailableOnly = isPointAvailableOnly ?: false,
contentType = contentType ?: ContentType.ALL
)
)
}
@GetMapping("/{id}/content") @GetMapping("/{id}/content")
fun getContentByTheme( fun getContentByTheme(
@PathVariable id: Long, @PathVariable id: Long,

View File

@@ -1,5 +1,6 @@
package kr.co.vividnext.sodalive.content.theme package kr.co.vividnext.sodalive.content.theme
import com.querydsl.core.types.dsl.CaseBuilder
import com.querydsl.jpa.impl.JPAQueryFactory import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.content.ContentType import kr.co.vividnext.sodalive.content.ContentType
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
@@ -32,6 +33,7 @@ class AudioContentThemeQueryRepository(
fun getActiveThemeOfContent( fun getActiveThemeOfContent(
isAdult: Boolean = false, isAdult: Boolean = false,
isFree: Boolean = false, isFree: Boolean = false,
isPointAvailableOnly: Boolean = false,
contentType: ContentType contentType: ContentType
): List<String> { ): List<String> {
var where = audioContent.isActive.isTrue var where = audioContent.isActive.isTrue
@@ -59,15 +61,31 @@ class AudioContentThemeQueryRepository(
where = where.and(audioContent.price.loe(0)) where = where.and(audioContent.price.loe(0))
} }
return queryFactory if (isPointAvailableOnly) {
where = where.and(audioContent.isPointAvailable.isTrue)
}
val query = queryFactory
.select(audioContentTheme.theme) .select(audioContentTheme.theme)
.from(audioContent) .from(audioContent)
.innerJoin(audioContent.member, member) .innerJoin(audioContent.member, member)
.innerJoin(audioContent.theme, audioContentTheme) .innerJoin(audioContent.theme, audioContentTheme)
.where(where) .where(where)
.groupBy(audioContentTheme.id) .groupBy(audioContentTheme.id)
.orderBy(audioContentTheme.orders.asc())
.fetch() if (isFree) {
query.orderBy(
CaseBuilder()
.`when`(audioContentTheme.theme.eq("자기소개")).then(0)
.otherwise(1)
.asc(),
audioContentTheme.orders.asc()
)
} else {
query.orderBy(audioContentTheme.orders.asc())
}
return query.fetch()
} }
fun findThemeByIdAndActive(id: Long): AudioContentTheme? { fun findThemeByIdAndActive(id: Long): AudioContentTheme? {

View File

@@ -23,11 +23,13 @@ class AudioContentThemeService(
fun getActiveThemeOfContent( fun getActiveThemeOfContent(
isAdult: Boolean = false, isAdult: Boolean = false,
isFree: Boolean = false, isFree: Boolean = false,
isPointAvailableOnly: Boolean = false,
contentType: ContentType contentType: ContentType
): List<String> { ): List<String> {
return queryRepository.getActiveThemeOfContent( return queryRepository.getActiveThemeOfContent(
isAdult = isAdult, isAdult = isAdult,
isFree = isFree, isFree = isFree,
isPointAvailableOnly = isPointAvailableOnly,
contentType = contentType contentType = contentType
) )
} }