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

View File

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