fix(recommendation): 홈 추천 query offset 범위를 확장한다
This commit is contained in:
@@ -51,7 +51,7 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
private val entityManager: EntityManager
|
||||
) : HomeRecommendationQueryRepository {
|
||||
override fun findLiveRecommendations(
|
||||
offset: Int,
|
||||
offset: Long,
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
includeAdultLives: Boolean
|
||||
@@ -79,7 +79,7 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
member.isActive.isTrue
|
||||
)
|
||||
.orderBy(liveRoom.beginDateTime.desc(), liveRoom.id.desc())
|
||||
.offset(offset.toLong())
|
||||
.offset(offset)
|
||||
.limit(limit.toLong())
|
||||
.fetch()
|
||||
}
|
||||
@@ -211,7 +211,7 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
|
||||
override fun findRecentDebutCreators(
|
||||
now: LocalDateTime,
|
||||
offset: Int,
|
||||
offset: Long,
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
includeAdultContents: Boolean
|
||||
@@ -355,7 +355,7 @@ class DefaultHomeRecommendationQueryRepository(
|
||||
|
||||
override fun findFirstAudioContents(
|
||||
now: LocalDateTime,
|
||||
offset: Int,
|
||||
offset: Long,
|
||||
limit: Int,
|
||||
memberId: Long?,
|
||||
includeAdultContents: Boolean
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.time.LocalDateTime
|
||||
|
||||
interface HomeRecommendationQueryPort {
|
||||
fun findLiveRecommendations(
|
||||
offset: Int = 0,
|
||||
offset: Long = 0,
|
||||
limit: Int,
|
||||
memberId: Long? = null,
|
||||
includeAdultLives: Boolean = false
|
||||
@@ -24,7 +24,7 @@ interface HomeRecommendationQueryPort {
|
||||
|
||||
fun findRecentDebutCreators(
|
||||
now: LocalDateTime,
|
||||
offset: Int = 0,
|
||||
offset: Long = 0,
|
||||
limit: Int,
|
||||
memberId: Long? = null,
|
||||
includeAdultContents: Boolean = false
|
||||
@@ -32,7 +32,7 @@ interface HomeRecommendationQueryPort {
|
||||
|
||||
fun findFirstAudioContents(
|
||||
now: LocalDateTime,
|
||||
offset: Int = 0,
|
||||
offset: Long = 0,
|
||||
limit: Int,
|
||||
memberId: Long? = null,
|
||||
includeAdultContents: Boolean = false
|
||||
|
||||
@@ -99,8 +99,8 @@ class DefaultHomeRecommendationQueryRepositoryTest @Autowired constructor(
|
||||
val oldest = saveLiveRoom(creator, baseAt, channelName = "paged-live-oldest", isAdult = false)
|
||||
flushAndClear()
|
||||
|
||||
val page0 = repository.findLiveRecommendations(offset = 0, limit = 3, includeAdultLives = false)
|
||||
val page1 = repository.findLiveRecommendations(offset = 2, limit = 3, includeAdultLives = false)
|
||||
val page0 = repository.findLiveRecommendations(offset = 0L, limit = 3, includeAdultLives = false)
|
||||
val page1 = repository.findLiveRecommendations(offset = 2L, limit = 3, includeAdultLives = false)
|
||||
|
||||
assertEquals(listOf(newest.id, middle.id, oldest.id), page0.map { it.liveRoomId })
|
||||
assertEquals(listOf(oldest.id), page1.map { it.liveRoomId })
|
||||
@@ -1032,8 +1032,8 @@ class DefaultHomeRecommendationQueryRepositoryTest @Autowired constructor(
|
||||
updateCreatedAt("AudioContentLike", like.id!!, now.minusHours(1))
|
||||
flushAndClear()
|
||||
|
||||
val page0 = repository.findRecentDebutCreators(now, offset = 0, limit = 2, includeAdultContents = false)
|
||||
val page1 = repository.findRecentDebutCreators(now, offset = 1, limit = 2, includeAdultContents = false)
|
||||
val page0 = repository.findRecentDebutCreators(now, offset = 0L, limit = 2, includeAdultContents = false)
|
||||
val page1 = repository.findRecentDebutCreators(now, offset = 1L, limit = 2, includeAdultContents = false)
|
||||
|
||||
assertEquals(listOf(normalNewest.id, normalOldest.id), page0.map { it.creatorId })
|
||||
assertEquals(listOf(normalOldest.id), page1.map { it.creatorId })
|
||||
@@ -1071,9 +1071,9 @@ class DefaultHomeRecommendationQueryRepositoryTest @Autowired constructor(
|
||||
saveAudioContent(creator3, now.minusDays(5), isActive = true)
|
||||
flushAndClear()
|
||||
|
||||
val page0 = repository.findRecentDebutCreators(now, offset = 0, limit = 1, includeAdultContents = false)
|
||||
val page1 = repository.findRecentDebutCreators(now, offset = 1, limit = 1, includeAdultContents = false)
|
||||
val page2 = repository.findRecentDebutCreators(now, offset = 2, limit = 1, includeAdultContents = false)
|
||||
val page0 = repository.findRecentDebutCreators(now, offset = 0L, limit = 1, includeAdultContents = false)
|
||||
val page1 = repository.findRecentDebutCreators(now, offset = 1L, limit = 1, includeAdultContents = false)
|
||||
val page2 = repository.findRecentDebutCreators(now, offset = 2L, limit = 1, includeAdultContents = false)
|
||||
|
||||
val pagedCreatorIds = (page0 + page1 + page2).map { it.creatorId }
|
||||
assertEquals(setOf(creator1.id, creator2.id, creator3.id), pagedCreatorIds.toSet())
|
||||
@@ -1157,8 +1157,8 @@ class DefaultHomeRecommendationQueryRepositoryTest @Autowired constructor(
|
||||
val oldest = saveAudioContent(oldestCreator, now.minusDays(21), isActive = true, isAdult = false)
|
||||
flushAndClear()
|
||||
|
||||
val page0 = repository.findFirstAudioContents(now, offset = 0, limit = 2, includeAdultContents = false)
|
||||
val page1 = repository.findFirstAudioContents(now, offset = 1, limit = 2, includeAdultContents = false)
|
||||
val page0 = repository.findFirstAudioContents(now, offset = 0L, limit = 2, includeAdultContents = false)
|
||||
val page1 = repository.findFirstAudioContents(now, offset = 1L, limit = 2, includeAdultContents = false)
|
||||
|
||||
assertEquals(listOf(newest.id, oldest.id), page0.map { it.contentId })
|
||||
assertEquals(listOf(oldest.id), page1.map { it.contentId })
|
||||
@@ -1196,9 +1196,9 @@ class DefaultHomeRecommendationQueryRepositoryTest @Autowired constructor(
|
||||
val content3 = saveAudioContent(creator3, now.minusDays(5), isActive = true)
|
||||
flushAndClear()
|
||||
|
||||
val page0 = repository.findFirstAudioContents(now, offset = 0, limit = 1, includeAdultContents = false)
|
||||
val page1 = repository.findFirstAudioContents(now, offset = 1, limit = 1, includeAdultContents = false)
|
||||
val page2 = repository.findFirstAudioContents(now, offset = 2, limit = 1, includeAdultContents = false)
|
||||
val page0 = repository.findFirstAudioContents(now, offset = 0L, limit = 1, includeAdultContents = false)
|
||||
val page1 = repository.findFirstAudioContents(now, offset = 1L, limit = 1, includeAdultContents = false)
|
||||
val page2 = repository.findFirstAudioContents(now, offset = 2L, limit = 1, includeAdultContents = false)
|
||||
|
||||
val pagedContentIds = (page0 + page1 + page2).map { it.contentId }
|
||||
assertEquals(setOf(content1.id, content2.id, content3.id), pagedContentIds.toSet())
|
||||
|
||||
Reference in New Issue
Block a user