feat(home): 메인 전체 탭 유료 오디오 필터를 적용한다

This commit is contained in:
2026-07-10 10:16:37 +09:00
parent 561e181859
commit d3d9855a52
4 changed files with 34 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ class DefaultMainContentAllQueryRepository(
memberId: Long?,
canViewAdultContent: Boolean,
now: LocalDateTime,
onlyPaid: Boolean,
onlyFree: Boolean,
onlyPointAvailable: Boolean
): Int {
@@ -44,7 +45,7 @@ class DefaultMainContentAllQueryRepository(
.from(audioContent)
.join(audioContent.member, member)
.join(audioContent.theme, audioContentTheme)
.where(audioCondition(memberId, canViewAdultContent, now, onlyFree, onlyPointAvailable))
.where(audioCondition(memberId, canViewAdultContent, now, onlyPaid, onlyFree, onlyPointAvailable))
.fetchOne()
?.toInt()
?: 0
@@ -57,10 +58,11 @@ class DefaultMainContentAllQueryRepository(
sort: ContentSort,
offset: Long,
limit: Int,
onlyPaid: Boolean,
onlyFree: Boolean,
onlyPointAvailable: Boolean
): List<MainContentAllAudio> {
val rows = findAudioRows(memberId, canViewAdultContent, now, sort, offset, limit, onlyFree, onlyPointAvailable)
val rows = findAudioRows(memberId, canViewAdultContent, now, sort, offset, limit, onlyPaid, onlyFree, onlyPointAvailable)
if (rows.isEmpty()) return emptyList()
val contentIds = rows.map { it.get(audioContent.id)!! }
@@ -157,6 +159,7 @@ class DefaultMainContentAllQueryRepository(
sort: ContentSort,
offset: Long,
limit: Int,
onlyPaid: Boolean,
onlyFree: Boolean,
onlyPointAvailable: Boolean
): List<Tuple> {
@@ -175,7 +178,7 @@ class DefaultMainContentAllQueryRepository(
.from(audioContent)
.join(audioContent.member, member)
.join(audioContent.theme, audioContentTheme)
.where(audioCondition(memberId, canViewAdultContent, now, onlyFree, onlyPointAvailable))
.where(audioCondition(memberId, canViewAdultContent, now, onlyPaid, onlyFree, onlyPointAvailable))
when (sort) {
ContentSort.POPULAR -> {
@@ -344,10 +347,12 @@ class DefaultMainContentAllQueryRepository(
memberId: Long?,
canViewAdultContent: Boolean,
now: LocalDateTime,
onlyPaid: Boolean,
onlyFree: Boolean,
onlyPointAvailable: Boolean
): BooleanExpression {
return publicAudioCondition(canViewAdultContent, now)
.and(optionalAudioPaidCondition(onlyPaid))
.and(optionalAudioFreeCondition(onlyFree))
.and(optionalAudioPointCondition(onlyPointAvailable))
.withOptionalAnd(notBlockedCreatorCondition(memberId, audioContent.member.id))
@@ -392,6 +397,10 @@ class DefaultMainContentAllQueryRepository(
.withOptionalAnd(notBlockedCreatorCondition(memberId, series.member.id))
}
private fun optionalAudioPaidCondition(onlyPaid: Boolean): BooleanExpression? {
return if (onlyPaid) audioContent.price.gt(0) else null
}
private fun optionalAudioFreeCondition(onlyFree: Boolean): BooleanExpression? {
return if (onlyFree) audioContent.price.eq(0) else null
}

View File

@@ -46,7 +46,8 @@ class MainContentAllQueryService(
page = resolvedPage,
memberId = memberId,
canViewAdultContent = canViewAdultContent,
now = now
now = now,
onlyPaid = true
)
MainContentAllType.FREE -> getAudioContents(
@@ -102,10 +103,18 @@ class MainContentAllQueryService(
memberId: Long?,
canViewAdultContent: Boolean,
now: LocalDateTime,
onlyPaid: Boolean = false,
onlyFree: Boolean = false,
onlyPointAvailable: Boolean = false
): MainContentAll {
val totalCount = queryPort.countAudios(memberId, canViewAdultContent, now, onlyFree, onlyPointAvailable)
val totalCount = queryPort.countAudios(
memberId = memberId,
canViewAdultContent = canViewAdultContent,
now = now,
onlyPaid = onlyPaid,
onlyFree = onlyFree,
onlyPointAvailable = onlyPointAvailable
)
val audios = queryPort.findAudios(
memberId = memberId,
canViewAdultContent = canViewAdultContent,
@@ -113,6 +122,7 @@ class MainContentAllQueryService(
sort = sort,
offset = page.offset,
limit = page.size + 1,
onlyPaid = onlyPaid,
onlyFree = onlyFree,
onlyPointAvailable = onlyPointAvailable
)

View File

@@ -11,6 +11,7 @@ interface MainContentAllQueryPort {
memberId: Long?,
canViewAdultContent: Boolean,
now: LocalDateTime,
onlyPaid: Boolean = false,
onlyFree: Boolean = false,
onlyPointAvailable: Boolean = false
): Int
@@ -22,6 +23,7 @@ interface MainContentAllQueryPort {
sort: ContentSort,
offset: Long,
limit: Int,
onlyPaid: Boolean = false,
onlyFree: Boolean = false,
onlyPointAvailable: Boolean = false
): List<MainContentAllAudio>