test #426
@@ -12,7 +12,7 @@ class RecommendationSnapshotPersistenceAdapter(
|
|||||||
) : RecommendationSnapshotPort {
|
) : RecommendationSnapshotPort {
|
||||||
override fun findLatestSnapshots(
|
override fun findLatestSnapshots(
|
||||||
sectionType: RecommendedSectionType,
|
sectionType: RecommendedSectionType,
|
||||||
offset: Int,
|
offset: Long,
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<RecommendationSnapshotRecord> {
|
): List<RecommendationSnapshotRecord> {
|
||||||
return repository.findLatestSnapshots(sectionType.name, offset, limit).map { it.toRecord() }
|
return repository.findLatestSnapshots(sectionType.name, offset, limit).map { it.toRecord() }
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ interface RecommendationSnapshotRepository : JpaRepository<RecommendationSnapsho
|
|||||||
)
|
)
|
||||||
fun findLatestSnapshots(
|
fun findLatestSnapshots(
|
||||||
@Param("sectionType") sectionType: String,
|
@Param("sectionType") sectionType: String,
|
||||||
@Param("offset") offset: Int,
|
@Param("offset") offset: Long,
|
||||||
@Param("limit") limit: Int
|
@Param("limit") limit: Int
|
||||||
): List<RecommendationSnapshot>
|
): List<RecommendationSnapshot>
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class HomeRecommendationQueryService(
|
|||||||
private val snapshotPort: RecommendationSnapshotPort
|
private val snapshotPort: RecommendationSnapshotPort
|
||||||
) {
|
) {
|
||||||
fun findLiveRecommendations(
|
fun findLiveRecommendations(
|
||||||
offset: Int = 0,
|
offset: Long = 0,
|
||||||
limit: Int = DEFAULT_LIVE_LIMIT,
|
limit: Int = DEFAULT_LIVE_LIMIT,
|
||||||
memberId: Long? = null,
|
memberId: Long? = null,
|
||||||
includeAdultLives: Boolean = false
|
includeAdultLives: Boolean = false
|
||||||
@@ -49,7 +49,7 @@ class HomeRecommendationQueryService(
|
|||||||
|
|
||||||
fun findRecentDebutCreators(
|
fun findRecentDebutCreators(
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
offset: Int = 0,
|
offset: Long = 0,
|
||||||
limit: Int = DEFAULT_RECENT_DEBUT_CREATOR_LIMIT,
|
limit: Int = DEFAULT_RECENT_DEBUT_CREATOR_LIMIT,
|
||||||
memberId: Long? = null,
|
memberId: Long? = null,
|
||||||
includeAdultContents: Boolean = false
|
includeAdultContents: Boolean = false
|
||||||
@@ -59,7 +59,7 @@ class HomeRecommendationQueryService(
|
|||||||
|
|
||||||
fun findFirstAudioContents(
|
fun findFirstAudioContents(
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
offset: Int = 0,
|
offset: Long = 0,
|
||||||
limit: Int = DEFAULT_FIRST_AUDIO_CONTENT_LIMIT,
|
limit: Int = DEFAULT_FIRST_AUDIO_CONTENT_LIMIT,
|
||||||
memberId: Long? = null,
|
memberId: Long? = null,
|
||||||
includeAdultContents: Boolean = false
|
includeAdultContents: Boolean = false
|
||||||
@@ -68,7 +68,7 @@ class HomeRecommendationQueryService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun findAiCharacterRecommendations(
|
fun findAiCharacterRecommendations(
|
||||||
offset: Int = 0,
|
offset: Long = 0,
|
||||||
limit: Int = DEFAULT_AI_CHARACTER_LIMIT
|
limit: Int = DEFAULT_AI_CHARACTER_LIMIT
|
||||||
): List<HomeAiCharacterRecommendationRecord> {
|
): List<HomeAiCharacterRecommendationRecord> {
|
||||||
val snapshots = snapshotPort.findLatestSnapshots(RecommendedSectionType.AI_CHARACTER, offset, limit)
|
val snapshots = snapshotPort.findLatestSnapshots(RecommendedSectionType.AI_CHARACTER, offset, limit)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.time.LocalDateTime
|
|||||||
interface RecommendationSnapshotPort {
|
interface RecommendationSnapshotPort {
|
||||||
fun findLatestSnapshots(
|
fun findLatestSnapshots(
|
||||||
sectionType: RecommendedSectionType,
|
sectionType: RecommendedSectionType,
|
||||||
offset: Int = 0,
|
offset: Long = 0,
|
||||||
limit: Int = Int.MAX_VALUE
|
limit: Int = Int.MAX_VALUE
|
||||||
): List<RecommendationSnapshotRecord>
|
): List<RecommendationSnapshotRecord>
|
||||||
|
|
||||||
|
|||||||
@@ -615,7 +615,7 @@ class HomeRecommendationQueryServiceTest {
|
|||||||
|
|
||||||
private class FakeHomeRecommendationQueryPort : HomeRecommendationQueryPort {
|
private class FakeHomeRecommendationQueryPort : HomeRecommendationQueryPort {
|
||||||
var liveLimit: Int? = null
|
var liveLimit: Int? = null
|
||||||
var liveOffset: Int? = null
|
var liveOffset: Long? = null
|
||||||
var liveMemberId: Long? = null
|
var liveMemberId: Long? = null
|
||||||
var liveIncludeAdultLives: Boolean? = null
|
var liveIncludeAdultLives: Boolean? = null
|
||||||
var bannerLimit: Int? = null
|
var bannerLimit: Int? = null
|
||||||
@@ -625,12 +625,12 @@ class HomeRecommendationQueryServiceTest {
|
|||||||
var activeCreatorIncludeAdultActivities: Boolean? = null
|
var activeCreatorIncludeAdultActivities: Boolean? = null
|
||||||
var recentDebutNow: LocalDateTime? = null
|
var recentDebutNow: LocalDateTime? = null
|
||||||
var recentDebutLimit: Int? = null
|
var recentDebutLimit: Int? = null
|
||||||
var recentDebutOffset: Int? = null
|
var recentDebutOffset: Long? = null
|
||||||
var recentDebutMemberId: Long? = null
|
var recentDebutMemberId: Long? = null
|
||||||
var recentDebutIncludeAdultContents: Boolean? = null
|
var recentDebutIncludeAdultContents: Boolean? = null
|
||||||
var firstAudioNow: LocalDateTime? = null
|
var firstAudioNow: LocalDateTime? = null
|
||||||
var firstAudioLimit: Int? = null
|
var firstAudioLimit: Int? = null
|
||||||
var firstAudioOffset: Int? = null
|
var firstAudioOffset: Long? = null
|
||||||
var firstAudioMemberId: Long? = null
|
var firstAudioMemberId: Long? = null
|
||||||
var firstAudioIncludeAdultContents: Boolean? = null
|
var firstAudioIncludeAdultContents: Boolean? = null
|
||||||
var aiCharacterDetailIds: List<Long> = emptyList()
|
var aiCharacterDetailIds: List<Long> = emptyList()
|
||||||
@@ -699,7 +699,7 @@ class HomeRecommendationQueryServiceTest {
|
|||||||
var genreCreatorRecommendations: List<HomeGenreCreatorRecommendationGroup> = emptyList()
|
var genreCreatorRecommendations: List<HomeGenreCreatorRecommendationGroup> = emptyList()
|
||||||
|
|
||||||
override fun findLiveRecommendations(
|
override fun findLiveRecommendations(
|
||||||
offset: Int,
|
offset: Long,
|
||||||
limit: Int,
|
limit: Int,
|
||||||
memberId: Long?,
|
memberId: Long?,
|
||||||
includeAdultLives: Boolean
|
includeAdultLives: Boolean
|
||||||
@@ -730,7 +730,7 @@ class HomeRecommendationQueryServiceTest {
|
|||||||
|
|
||||||
override fun findRecentDebutCreators(
|
override fun findRecentDebutCreators(
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
offset: Int,
|
offset: Long,
|
||||||
limit: Int,
|
limit: Int,
|
||||||
memberId: Long?,
|
memberId: Long?,
|
||||||
includeAdultContents: Boolean
|
includeAdultContents: Boolean
|
||||||
@@ -745,7 +745,7 @@ class HomeRecommendationQueryServiceTest {
|
|||||||
|
|
||||||
override fun findFirstAudioContents(
|
override fun findFirstAudioContents(
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
offset: Int,
|
offset: Long,
|
||||||
limit: Int,
|
limit: Int,
|
||||||
memberId: Long?,
|
memberId: Long?,
|
||||||
includeAdultContents: Boolean
|
includeAdultContents: Boolean
|
||||||
@@ -821,7 +821,7 @@ private class FakeHomeRecommendationSnapshotPort : RecommendationSnapshotPort {
|
|||||||
|
|
||||||
override fun findLatestSnapshots(
|
override fun findLatestSnapshots(
|
||||||
sectionType: RecommendedSectionType,
|
sectionType: RecommendedSectionType,
|
||||||
offset: Int,
|
offset: Long,
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<RecommendationSnapshotRecord> {
|
): List<RecommendationSnapshotRecord> {
|
||||||
val latestSnapshotAt = snapshots
|
val latestSnapshotAt = snapshots
|
||||||
@@ -832,8 +832,8 @@ private class FakeHomeRecommendationSnapshotPort : RecommendationSnapshotPort {
|
|||||||
.filter { it.sectionType == sectionType && it.snapshotAt == latestSnapshotAt }
|
.filter { it.sectionType == sectionType && it.snapshotAt == latestSnapshotAt }
|
||||||
.sortedWith(compareByDescending<RecommendationSnapshotRecord> { it.score }.thenBy { it.randomTieBreaker })
|
.sortedWith(compareByDescending<RecommendationSnapshotRecord> { it.score }.thenBy { it.randomTieBreaker })
|
||||||
|
|
||||||
if (offset == 0 && limit == Int.MAX_VALUE) return all
|
if (offset == 0L && limit == Int.MAX_VALUE) return all
|
||||||
return all.drop(offset).take(limit)
|
return all.drop(offset.toInt()).take(limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceSnapshots(
|
override fun replaceSnapshots(
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ private class FakeRecommendationSnapshotPort : RecommendationSnapshotPort {
|
|||||||
|
|
||||||
override fun findLatestSnapshots(
|
override fun findLatestSnapshots(
|
||||||
sectionType: RecommendedSectionType,
|
sectionType: RecommendedSectionType,
|
||||||
offset: Int,
|
offset: Long,
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<RecommendationSnapshotRecord> {
|
): List<RecommendationSnapshotRecord> {
|
||||||
val latestSnapshotAt = snapshots
|
val latestSnapshotAt = snapshots
|
||||||
@@ -267,8 +267,8 @@ private class FakeRecommendationSnapshotPort : RecommendationSnapshotPort {
|
|||||||
.filter { it.sectionType == sectionType && it.snapshotAt == latestSnapshotAt }
|
.filter { it.sectionType == sectionType && it.snapshotAt == latestSnapshotAt }
|
||||||
.sortedWith(compareByDescending<RecommendationSnapshotRecord> { it.score }.thenBy { it.randomTieBreaker })
|
.sortedWith(compareByDescending<RecommendationSnapshotRecord> { it.score }.thenBy { it.randomTieBreaker })
|
||||||
|
|
||||||
if (offset == 0 && limit == Int.MAX_VALUE) return all
|
if (offset == 0L && limit == Int.MAX_VALUE) return all
|
||||||
return all.drop(offset).take(limit)
|
return all.drop(offset.toInt()).take(limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceSnapshots(
|
override fun replaceSnapshots(
|
||||||
|
|||||||
Reference in New Issue
Block a user