diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentController.kt index fafccf7..268e0d7 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentController.kt @@ -175,6 +175,8 @@ class AudioContentController(private val service: AudioContentService) { @GetMapping("/ranking") fun getAudioContentRanking( @RequestParam("sort-type", required = false) sortType: String? = "매출", + @RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null, + @RequestParam("contentType", required = false) contentType: ContentType? = null, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, pageable: Pageable ) = run { @@ -192,7 +194,8 @@ class AudioContentController(private val service: AudioContentService) { ApiResponse.ok( service.getAudioContentRanking( - isAdult = member.auth != null, + isAdult = member.auth != null && (isAdultContentVisible ?: true), + contentType = contentType ?: ContentType.ALL, startDate = startDate, endDate = endDate, offset = pageable.offset, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt index 1e785f2..35d858a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -140,6 +140,7 @@ interface AudioContentQueryRepository { fun getAudioContentRanking( cloudfrontHost: String, isAdult: Boolean, + contentType: ContentType, startDate: LocalDateTime, endDate: LocalDateTime, offset: Long = 0, @@ -922,6 +923,7 @@ class AudioContentQueryRepositoryImpl( override fun getAudioContentRanking( cloudfrontHost: String, isAdult: Boolean, + contentType: ContentType, startDate: LocalDateTime, endDate: LocalDateTime, offset: Long, @@ -938,6 +940,20 @@ class AudioContentQueryRepositoryImpl( if (!isAdult) { where = where.and(audioContent.isAdult.isFalse) + } else { + if (contentType != ContentType.ALL) { + where = where.and( + audioContent.member.isNull.or( + audioContent.member.auth.gender.eq( + if (contentType == ContentType.MALE) { + 0 + } else { + 1 + } + ) + ) + ) + } } var select = queryFactory diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt index db7db4c..cc458ba 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt @@ -759,6 +759,7 @@ class AudioContentService( ) fun getAudioContentRanking( isAdult: Boolean, + contentType: ContentType, startDate: LocalDateTime, endDate: LocalDateTime, offset: Long, @@ -774,6 +775,7 @@ class AudioContentService( startDate = startDate.minusDays(1), endDate = endDate.minusDays(1), isAdult = isAdult, + contentType = contentType, offset = offset, limit = limit, sortType = sortType diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/main/tab/content/AudioContentMainTabContentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/main/tab/content/AudioContentMainTabContentService.kt index 9d8fd17..09ce755 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/main/tab/content/AudioContentMainTabContentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/main/tab/content/AudioContentMainTabContentService.kt @@ -88,6 +88,7 @@ class AudioContentMainTabContentService( val contentRankCreatorList = rankingService.fetchCreatorBySellContentCountRankTop20( memberId = member.id!!, + isAdult = isAdult, contentType = contentType, startDate = dailyRankingStartDate, endDate = dailyRankingEndDate