From 713d42a67453b676b62c1bef54661596f5ffbcbe Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 14 Feb 2025 15:55:21 +0900 Subject: [PATCH] =?UTF-8?q?=EC=83=88=EB=A1=9C=EC=9A=B4=20=EC=BD=98?= =?UTF-8?q?=ED=85=90=EC=B8=A0=20=EC=A0=84=EC=B2=B4=EB=B3=B4=EA=B8=B0=20-?= =?UTF-8?q?=20=EB=AC=B4=EB=A3=8C=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=EB=B3=B4=EA=B8=B0=EB=A5=BC=20=EC=9C=84=ED=95=B4=20isF?= =?UTF-8?q?ree=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/content/AudioContentRepository.kt | 12 ++++++++++++ .../content/main/AudioContentMainController.kt | 2 ++ .../sodalive/content/main/AudioContentMainService.kt | 3 +++ 3 files changed, 17 insertions(+) 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 6451801..eacea2a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -81,6 +81,7 @@ interface AudioContentQueryRepository { ): Int fun findByThemeFor2Weeks( + isFree: Boolean = false, cloudfrontHost: String, memberId: Long, theme: String = "", @@ -91,6 +92,7 @@ interface AudioContentQueryRepository { ): List fun totalCountNewContentFor2Weeks( + isFree: Boolean = false, theme: String, memberId: Long, isAdult: Boolean, @@ -456,6 +458,7 @@ class AudioContentQueryRepositoryImpl( } override fun totalCountNewContentFor2Weeks( + isFree: Boolean, theme: String, memberId: Long, isAdult: Boolean, @@ -484,6 +487,10 @@ class AudioContentQueryRepositoryImpl( where = where.and(audioContentTheme.theme.eq(theme)) } + if (isFree) { + where = where.and(audioContent.price.loe(0)) + } + return queryFactory .select(audioContent.id) .from(audioContent) @@ -495,6 +502,7 @@ class AudioContentQueryRepositoryImpl( } override fun findByThemeFor2Weeks( + isFree: Boolean, cloudfrontHost: String, memberId: Long, theme: String, @@ -526,6 +534,10 @@ class AudioContentQueryRepositoryImpl( where = where.and(audioContentTheme.theme.eq(theme)) } + if (isFree) { + where = where.and(audioContent.price.loe(0)) + } + return queryFactory .select( QGetAudioContentMainItem( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainController.kt index c1fc22d..de06c18 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainController.kt @@ -92,6 +92,7 @@ class AudioContentMainController( @GetMapping("/new/all") fun getNewContentAllByTheme( + @RequestParam("isFree", required = false) isFree: Boolean? = null, @RequestParam("theme") theme: String, @RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null, @RequestParam("contentType", required = false) contentType: ContentType? = null, @@ -102,6 +103,7 @@ class AudioContentMainController( ApiResponse.ok( service.getNewContentFor2WeeksByTheme( + isFree = isFree ?: false, theme = theme, isAdultContentVisible = isAdultContentVisible ?: true, contentType = contentType ?: ContentType.ALL, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainService.kt index b72b829..faabf41 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/main/AudioContentMainService.kt @@ -50,6 +50,7 @@ class AudioContentMainService( @Transactional(readOnly = true) fun getNewContentFor2WeeksByTheme( + isFree: Boolean, theme: String, isAdultContentVisible: Boolean, contentType: ContentType, @@ -57,12 +58,14 @@ class AudioContentMainService( pageable: Pageable ): GetNewContentAllResponse { val totalCount = repository.totalCountNewContentFor2Weeks( + isFree, theme, memberId = member.id!!, isAdult = member.auth != null && isAdultContentVisible, contentType = contentType ) val items = repository.findByThemeFor2Weeks( + isFree, cloudfrontHost = imageHost, memberId = member.id!!, theme = theme,