fix: 최근 종료한 라이브 API 오류 수정

This commit is contained in:
Klaus 2025-07-18 18:00:36 +09:00
parent 2192ddc8fa
commit a99260209b
2 changed files with 13 additions and 23 deletions

View File

@ -61,7 +61,7 @@ interface LiveRoomQueryRepository {
fun getTotalHeartCount(roomId: Long): Int?
fun getLiveRoomCreatorId(roomId: Long): Long?
fun getHeartList(roomId: Long): List<GetLiveRoomHeartListItem>
fun getLatestFinishedLive(offset: Long): List<GetLatestFinishedLiveQueryResponse>
fun getLatestFinishedLive(): List<GetLatestFinishedLiveQueryResponse>
}
class LiveRoomQueryRepositoryImpl(
@ -383,7 +383,7 @@ class LiveRoomQueryRepositoryImpl(
.fetch()
}
override fun getLatestFinishedLive(offset: Long): List<GetLatestFinishedLiveQueryResponse> {
override fun getLatestFinishedLive(): List<GetLatestFinishedLiveQueryResponse> {
val liveRoom = liveRoom
val subLiveRoom = QLiveRoom.liveRoom
@ -413,7 +413,6 @@ class LiveRoomQueryRepositoryImpl(
.`in`(subQuery)
)
.orderBy(liveRoom.updatedAt.desc())
.offset(offset)
.limit(20)
.fetch()
}

View File

@ -1298,25 +1298,16 @@ class LiveRoomService(
}
fun getLatestFinishedLive(member: Member?): List<GetLatestFinishedLiveResponse> {
val result = mutableListOf<GetLatestFinishedLiveResponse>()
var retry = 0L
do {
result.addAll(
repository.getLatestFinishedLive(offset = retry)
.filter {
if (member?.id != null) {
!blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.memberId)
} else {
true
}
}
.map {
GetLatestFinishedLiveResponse(response = it)
}
)
} while (result.size < 20 && retry++ < 3)
return result.take(20)
return repository.getLatestFinishedLive()
.filter {
if (member?.id != null) {
!blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.memberId)
} else {
true
}
}
.map {
GetLatestFinishedLiveResponse(response = it)
}
}
}