fix(creator): 라이브 다시듣기 첫 콘텐츠 기준을 보정한다
This commit is contained in:
@@ -120,7 +120,7 @@ class DefaultCreatorChannelLiveQueryRepository(
|
||||
): List<CreatorChannelAudioContentRecord> {
|
||||
val rows = findLiveReplayAudioRows(creatorId, viewerId, now, canViewAdultContent, sort, offset, limit)
|
||||
val contentIds = rows.map { itAudioId(it) }
|
||||
val firstContentId = firstLiveReplayAudioContentId(creatorId, now, canViewAdultContent)
|
||||
val firstContentId = firstAudioContentId(creatorId, now, canViewAdultContent)
|
||||
val seriesByContentId = audioSeriesByContentIds(contentIds)
|
||||
val orderStatesByContentId = orderStatesByContentIds(viewerId, contentIds, now)
|
||||
|
||||
@@ -269,7 +269,7 @@ class DefaultCreatorChannelLiveQueryRepository(
|
||||
)
|
||||
}
|
||||
|
||||
private fun firstLiveReplayAudioContentId(
|
||||
private fun firstAudioContentId(
|
||||
creatorId: Long,
|
||||
now: LocalDateTime,
|
||||
canViewAdultContent: Boolean
|
||||
@@ -277,8 +277,15 @@ class DefaultCreatorChannelLiveQueryRepository(
|
||||
return queryFactory
|
||||
.select(audioContent.id)
|
||||
.from(audioContent)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.where(liveReplayAudioCondition(creatorId, now, canViewAdultContent))
|
||||
.where(
|
||||
audioContent.member.id.eq(creatorId),
|
||||
audioContent.member.isActive.isTrue,
|
||||
audioContent.isActive.isTrue,
|
||||
audioContent.duration.isNotNull,
|
||||
audioContent.releaseDate.isNotNull,
|
||||
audioContent.releaseDate.loe(now),
|
||||
adultAudioCondition(canViewAdultContent)
|
||||
)
|
||||
.orderBy(audioContent.releaseDate.asc(), audioContent.id.asc())
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
@@ -108,6 +108,39 @@ class DefaultCreatorChannelLiveQueryRepositoryTest @Autowired constructor(
|
||||
assertTrue(secondPage.last().isFirstContent)
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("라이브 다시듣기의 isFirstContent는 테마가 아니라 전체 공개 오디오 콘텐츠 첫 항목을 기준으로 한다")
|
||||
fun shouldMarkFirstContentByAllPublicAudioContentsNotLiveReplayTheme() {
|
||||
val now = LocalDateTime.of(2026, 6, 17, 12, 0)
|
||||
val creator = saveMember("first-content-creator", MemberRole.CREATOR)
|
||||
saveAudioContent(
|
||||
creator = creator,
|
||||
releaseDate = now.minusDays(10),
|
||||
isAdult = false,
|
||||
theme = saveTheme("수면")
|
||||
)
|
||||
val liveReplay = saveAudioContent(
|
||||
creator = creator,
|
||||
releaseDate = now.minusDays(1),
|
||||
isAdult = false,
|
||||
theme = saveTheme("다시듣기")
|
||||
)
|
||||
flushAndClear()
|
||||
|
||||
val records = repository.findLiveReplayAudioContents(
|
||||
creatorId = creator.id!!,
|
||||
viewerId = null,
|
||||
now = now,
|
||||
canViewAdultContent = false,
|
||||
sort = ContentSort.LATEST,
|
||||
offset = 0,
|
||||
limit = 20
|
||||
)
|
||||
|
||||
assertEquals(listOf(liveReplay.id), records.map { it.audioContentId })
|
||||
assertEquals(listOf(false), records.map { it.isFirstContent })
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("라이브 다시듣기 목록은 가격 정렬을 적용한다")
|
||||
fun shouldSortLiveReplayAudioContentsByPrice() {
|
||||
|
||||
Reference in New Issue
Block a user