Compare commits
16 Commits
02ae507c87
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 587f3d6b58 | |||
| 76806e2e90 | |||
| 39c51825da | |||
| 9b6167d46d | |||
| 9a58b7b95f | |||
| 26eae4b06e | |||
| 008ee3b4e5 | |||
| 60989391f6 | |||
| 88d90eec2f | |||
| b6eb13df06 | |||
| 3a57ad23bb | |||
| a6b815ad05 | |||
| d89122802a | |||
| 729552335a | |||
| 690432d6ee | |||
| bc358d18de |
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,7 +176,9 @@ class ContentSeriesQueryRepositoryImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val orderBy = if (creatorId != null) {
|
val orderBy = if (orderByRandom) {
|
||||||
|
listOf(Expressions.numberTemplate(Double::class.java, "function('rand')").asc())
|
||||||
|
} else if (creatorId != null) {
|
||||||
listOf(series.orders.asc(), series.createdAt.asc())
|
listOf(series.orders.asc(), series.createdAt.asc())
|
||||||
} else {
|
} else {
|
||||||
listOf(audioContent.releaseDate.max().desc(), series.createdAt.asc())
|
listOf(audioContent.releaseDate.max().desc(), series.createdAt.asc())
|
||||||
@@ -362,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> {
|
||||||
@@ -390,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()
|
||||||
|
|||||||
@@ -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!!) }
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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? {
|
||||||
|
|||||||
@@ -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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user