fix(recommendation): 추천 snapshot offset 범위를 확장한다

This commit is contained in:
2026-06-27 05:11:22 +09:00
parent 63df1b5777
commit 24e217e8ee
6 changed files with 19 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ class RecommendationSnapshotPersistenceAdapter(
) : RecommendationSnapshotPort {
override fun findLatestSnapshots(
sectionType: RecommendedSectionType,
offset: Int,
offset: Long,
limit: Int
): List<RecommendationSnapshotRecord> {
return repository.findLatestSnapshots(sectionType.name, offset, limit).map { it.toRecord() }

View File

@@ -24,7 +24,7 @@ interface RecommendationSnapshotRepository : JpaRepository<RecommendationSnapsho
)
fun findLatestSnapshots(
@Param("sectionType") sectionType: String,
@Param("offset") offset: Int,
@Param("offset") offset: Long,
@Param("limit") limit: Int
): List<RecommendationSnapshot>

View File

@@ -24,7 +24,7 @@ class HomeRecommendationQueryService(
private val snapshotPort: RecommendationSnapshotPort
) {
fun findLiveRecommendations(
offset: Int = 0,
offset: Long = 0,
limit: Int = DEFAULT_LIVE_LIMIT,
memberId: Long? = null,
includeAdultLives: Boolean = false
@@ -49,7 +49,7 @@ class HomeRecommendationQueryService(
fun findRecentDebutCreators(
now: LocalDateTime,
offset: Int = 0,
offset: Long = 0,
limit: Int = DEFAULT_RECENT_DEBUT_CREATOR_LIMIT,
memberId: Long? = null,
includeAdultContents: Boolean = false
@@ -59,7 +59,7 @@ class HomeRecommendationQueryService(
fun findFirstAudioContents(
now: LocalDateTime,
offset: Int = 0,
offset: Long = 0,
limit: Int = DEFAULT_FIRST_AUDIO_CONTENT_LIMIT,
memberId: Long? = null,
includeAdultContents: Boolean = false
@@ -68,7 +68,7 @@ class HomeRecommendationQueryService(
}
fun findAiCharacterRecommendations(
offset: Int = 0,
offset: Long = 0,
limit: Int = DEFAULT_AI_CHARACTER_LIMIT
): List<HomeAiCharacterRecommendationRecord> {
val snapshots = snapshotPort.findLatestSnapshots(RecommendedSectionType.AI_CHARACTER, offset, limit)

View File

@@ -6,7 +6,7 @@ import java.time.LocalDateTime
interface RecommendationSnapshotPort {
fun findLatestSnapshots(
sectionType: RecommendedSectionType,
offset: Int = 0,
offset: Long = 0,
limit: Int = Int.MAX_VALUE
): List<RecommendationSnapshotRecord>

View File

@@ -615,7 +615,7 @@ class HomeRecommendationQueryServiceTest {
private class FakeHomeRecommendationQueryPort : HomeRecommendationQueryPort {
var liveLimit: Int? = null
var liveOffset: Int? = null
var liveOffset: Long? = null
var liveMemberId: Long? = null
var liveIncludeAdultLives: Boolean? = null
var bannerLimit: Int? = null
@@ -625,12 +625,12 @@ class HomeRecommendationQueryServiceTest {
var activeCreatorIncludeAdultActivities: Boolean? = null
var recentDebutNow: LocalDateTime? = null
var recentDebutLimit: Int? = null
var recentDebutOffset: Int? = null
var recentDebutOffset: Long? = null
var recentDebutMemberId: Long? = null
var recentDebutIncludeAdultContents: Boolean? = null
var firstAudioNow: LocalDateTime? = null
var firstAudioLimit: Int? = null
var firstAudioOffset: Int? = null
var firstAudioOffset: Long? = null
var firstAudioMemberId: Long? = null
var firstAudioIncludeAdultContents: Boolean? = null
var aiCharacterDetailIds: List<Long> = emptyList()
@@ -699,7 +699,7 @@ class HomeRecommendationQueryServiceTest {
var genreCreatorRecommendations: List<HomeGenreCreatorRecommendationGroup> = emptyList()
override fun findLiveRecommendations(
offset: Int,
offset: Long,
limit: Int,
memberId: Long?,
includeAdultLives: Boolean
@@ -730,7 +730,7 @@ class HomeRecommendationQueryServiceTest {
override fun findRecentDebutCreators(
now: LocalDateTime,
offset: Int,
offset: Long,
limit: Int,
memberId: Long?,
includeAdultContents: Boolean
@@ -745,7 +745,7 @@ class HomeRecommendationQueryServiceTest {
override fun findFirstAudioContents(
now: LocalDateTime,
offset: Int,
offset: Long,
limit: Int,
memberId: Long?,
includeAdultContents: Boolean
@@ -821,7 +821,7 @@ private class FakeHomeRecommendationSnapshotPort : RecommendationSnapshotPort {
override fun findLatestSnapshots(
sectionType: RecommendedSectionType,
offset: Int,
offset: Long,
limit: Int
): List<RecommendationSnapshotRecord> {
val latestSnapshotAt = snapshots
@@ -832,8 +832,8 @@ private class FakeHomeRecommendationSnapshotPort : RecommendationSnapshotPort {
.filter { it.sectionType == sectionType && it.snapshotAt == latestSnapshotAt }
.sortedWith(compareByDescending<RecommendationSnapshotRecord> { it.score }.thenBy { it.randomTieBreaker })
if (offset == 0 && limit == Int.MAX_VALUE) return all
return all.drop(offset).take(limit)
if (offset == 0L && limit == Int.MAX_VALUE) return all
return all.drop(offset.toInt()).take(limit)
}
override fun replaceSnapshots(

View File

@@ -256,7 +256,7 @@ private class FakeRecommendationSnapshotPort : RecommendationSnapshotPort {
override fun findLatestSnapshots(
sectionType: RecommendedSectionType,
offset: Int,
offset: Long,
limit: Int
): List<RecommendationSnapshotRecord> {
val latestSnapshotAt = snapshots
@@ -267,8 +267,8 @@ private class FakeRecommendationSnapshotPort : RecommendationSnapshotPort {
.filter { it.sectionType == sectionType && it.snapshotAt == latestSnapshotAt }
.sortedWith(compareByDescending<RecommendationSnapshotRecord> { it.score }.thenBy { it.randomTieBreaker })
if (offset == 0 && limit == Int.MAX_VALUE) return all
return all.drop(offset).take(limit)
if (offset == 0L && limit == Int.MAX_VALUE) return all
return all.drop(offset.toInt()).take(limit)
}
override fun replaceSnapshots(