fix(series): 오리지널 시리즈 조회에 양방향 차단 필터를 적용한다
This commit is contained in:
15
docs/20260226_오리지널시리즈차단필터적용.md
Normal file
15
docs/20260226_오리지널시리즈차단필터적용.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 오리지널 시리즈 차단 필터 적용
|
||||
|
||||
## 구현 체크리스트
|
||||
- [x] `HomeService.fetchData` 경로에서 오리지널 시리즈 조회 시 `memberId` 전달
|
||||
- [x] `ContentSeriesService.getOriginalAudioDramaList` 시그니처에 `memberId` 반영
|
||||
- [x] `ContentSeriesRepository.getOriginalAudioDramaList` 인터페이스/구현에 `memberId` 반영
|
||||
- [x] 오리지널 시리즈 QueryDSL 조회에 양방향 차단(`내가 차단`/`나를 차단`) 서브쿼리 필터 적용
|
||||
- [x] 오리지널 탭 API 경로(`AudioContentMainTabSeries*`)에도 `memberId` 전달
|
||||
- [x] 빌드/테스트/진단 실행 후 결과 기록
|
||||
|
||||
## 검증 기록
|
||||
- 1차 구현
|
||||
- 무엇을: 홈/시리즈탭의 오리지널 시리즈 조회 경로에 `memberId`를 전달하고, `ContentSeriesRepository.getOriginalAudioDramaList` 및 `getOriginalAudioDramaTotalCount`에 양방향 차단 서브쿼리(`blockedSubquery.exists().not()`)를 추가해 차단된 크리에이터 시리즈가 제외되도록 반영했다.
|
||||
- 왜: 기존에는 오리지널 시리즈 조회 쿼리에 차단 조건이 없어, 내가 차단했거나 나를 차단한 크리에이터의 시리즈가 노출될 수 있었다.
|
||||
- 어떻게: `./gradlew test` 실행 성공, `./gradlew build` 실행 성공으로 컴파일/테스트/정적검사(ktlint 포함 check 단계) 통과를 확인했다. Kotlin LSP는 환경에 서버가 없어(`.kt` 미지원) 진단 도구로는 확인할 수 없어 Gradle 빌드 기반으로 검증했다.
|
||||
@@ -126,6 +126,7 @@ class HomeService(
|
||||
)
|
||||
|
||||
val originalAudioDramaList = seriesService.getOriginalAudioDramaList(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType
|
||||
)
|
||||
|
||||
@@ -42,6 +42,7 @@ class AudioContentMainTabSeriesController(private val service: AudioContentMainT
|
||||
|
||||
ApiResponse.ok(
|
||||
service.getOriginalAudioDramaList(
|
||||
memberId = member.id!!,
|
||||
isAdult = member.auth != null && (isAdultContentVisible ?: true),
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
offset = pageable.offset,
|
||||
|
||||
@@ -41,6 +41,7 @@ class AudioContentMainTabSeriesService(
|
||||
)
|
||||
|
||||
val originalAudioDrama = seriesService.getOriginalAudioDramaList(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
offset = 0,
|
||||
@@ -157,13 +158,15 @@ class AudioContentMainTabSeriesService(
|
||||
}
|
||||
|
||||
fun getOriginalAudioDramaList(
|
||||
memberId: Long,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): GetSeriesListResponse {
|
||||
val totalCount = seriesService.getOriginalAudioDramaTotalCount(isAdult, contentType)
|
||||
val totalCount = seriesService.getOriginalAudioDramaTotalCount(memberId, isAdult, contentType)
|
||||
val items = seriesService.getOriginalAudioDramaList(
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
offset = offset,
|
||||
|
||||
@@ -84,11 +84,12 @@ interface ContentSeriesQueryRepository {
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
locale: String,
|
||||
memberId: Long? = null,
|
||||
offset: Long = 0,
|
||||
limit: Long = 20
|
||||
): List<GetSeriesListResponse.SeriesListItem>
|
||||
|
||||
fun getOriginalAudioDramaTotalCount(isAdult: Boolean, contentType: ContentType): Int
|
||||
fun getOriginalAudioDramaTotalCount(isAdult: Boolean, contentType: ContentType, memberId: Long? = null): Int
|
||||
fun getGenreList(isAdult: Boolean, memberId: Long, contentType: ContentType): List<GetSeriesGenreListResponse>
|
||||
fun findByCurationIdV2(
|
||||
imageHost: String,
|
||||
@@ -715,6 +716,7 @@ class ContentSeriesQueryRepositoryImpl(
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
locale: String,
|
||||
memberId: Long?,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<GetSeriesListResponse.SeriesListItem> {
|
||||
@@ -744,6 +746,24 @@ class ContentSeriesQueryRepositoryImpl(
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
}
|
||||
|
||||
if (memberId != null) {
|
||||
val blockedSubquery = queryFactory
|
||||
.select(blockMember.id)
|
||||
.from(blockMember)
|
||||
.where(
|
||||
blockMember.isActive.isTrue
|
||||
.and(
|
||||
blockMember.member.id.eq(series.member.id)
|
||||
.and(blockMember.blockedMember.id.eq(memberId))
|
||||
.or(
|
||||
blockMember.member.id.eq(memberId)
|
||||
.and(blockMember.blockedMember.id.eq(series.member.id))
|
||||
)
|
||||
)
|
||||
)
|
||||
where = where.and(blockedSubquery.exists().not())
|
||||
}
|
||||
|
||||
val now = LocalDateTime.now()
|
||||
val sevenDaysAgo = now.minusDays(7)
|
||||
|
||||
@@ -823,7 +843,7 @@ class ContentSeriesQueryRepositoryImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getOriginalAudioDramaTotalCount(isAdult: Boolean, contentType: ContentType): Int {
|
||||
override fun getOriginalAudioDramaTotalCount(isAdult: Boolean, contentType: ContentType, memberId: Long?): Int {
|
||||
var where = series.isOriginal.isTrue
|
||||
.and(series.isActive.isTrue)
|
||||
|
||||
@@ -845,6 +865,24 @@ class ContentSeriesQueryRepositoryImpl(
|
||||
}
|
||||
}
|
||||
|
||||
if (memberId != null) {
|
||||
val blockedSubquery = queryFactory
|
||||
.select(blockMember.id)
|
||||
.from(blockMember)
|
||||
.where(
|
||||
blockMember.isActive.isTrue
|
||||
.and(
|
||||
blockMember.member.id.eq(series.member.id)
|
||||
.and(blockMember.blockedMember.id.eq(memberId))
|
||||
.or(
|
||||
blockMember.member.id.eq(memberId)
|
||||
.and(blockMember.blockedMember.id.eq(series.member.id))
|
||||
)
|
||||
)
|
||||
)
|
||||
where = where.and(blockedSubquery.exists().not())
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(series.id)
|
||||
.from(series)
|
||||
|
||||
@@ -46,10 +46,27 @@ class ContentSeriesService(
|
||||
private val coverImageHost: String
|
||||
) {
|
||||
fun getOriginalAudioDramaTotalCount(isAdult: Boolean, contentType: ContentType): Int {
|
||||
return repository.getOriginalAudioDramaTotalCount(isAdult, contentType)
|
||||
return repository.getOriginalAudioDramaTotalCount(
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
memberId = null
|
||||
)
|
||||
}
|
||||
|
||||
fun getOriginalAudioDramaTotalCount(
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType
|
||||
): Int {
|
||||
return repository.getOriginalAudioDramaTotalCount(
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
memberId = memberId
|
||||
)
|
||||
}
|
||||
|
||||
fun getOriginalAudioDramaList(
|
||||
memberId: Long?,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
offset: Long = 0,
|
||||
@@ -60,6 +77,7 @@ class ContentSeriesService(
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
locale = langContext.lang.code,
|
||||
memberId = memberId,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user