From c028aa4002e5fe3ad4efbcacc7446be460af9956 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sat, 27 Jun 2026 05:11:51 +0900 Subject: [PATCH] =?UTF-8?q?fix(recommendation):=20=ED=99=88=20=EC=B6=94?= =?UTF-8?q?=EC=B2=9C=20query=20offset=20=EB=B2=94=EC=9C=84=EB=A5=BC=20?= =?UTF-8?q?=ED=99=95=EC=9E=A5=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...efaultHomeRecommendationQueryRepository.kt | 8 +++---- .../port/out/HomeRecommendationQueryPort.kt | 6 ++--- ...ltHomeRecommendationQueryRepositoryTest.kt | 24 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepository.kt index 3a2e00d2..5c377153 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepository.kt @@ -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 diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/port/out/HomeRecommendationQueryPort.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/port/out/HomeRecommendationQueryPort.kt index 25afd146..b6c3e220 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/port/out/HomeRecommendationQueryPort.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/recommendation/port/out/HomeRecommendationQueryPort.kt @@ -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 diff --git a/src/test/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepositoryTest.kt b/src/test/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepositoryTest.kt index 38c1a8a2..0fccae42 100644 --- a/src/test/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepositoryTest.kt +++ b/src/test/kotlin/kr/co/vividnext/sodalive/v2/recommendation/adapter/out/persistence/DefaultHomeRecommendationQueryRepositoryTest.kt @@ -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())