test #332
| @@ -1,9 +1,29 @@ | ||||
| package kr.co.vividnext.sodalive.live.room | ||||
|  | ||||
| import com.querydsl.core.annotations.QueryProjection | ||||
| import kr.co.vividnext.sodalive.extensions.getTimeAgoString | ||||
| import java.time.LocalDateTime | ||||
|  | ||||
| data class GetLatestFinishedLiveQueryResponse @QueryProjection constructor( | ||||
|     val memberId: Long, | ||||
|     val nickname: String, | ||||
|     val profileImageUrl: String, | ||||
|     val title: String, | ||||
|     val updatedAt: LocalDateTime | ||||
| ) | ||||
|  | ||||
| data class GetLatestFinishedLiveResponse( | ||||
|     val memberId: Long, | ||||
|     val nickname: String, | ||||
|     val profileImageUrl: String, | ||||
|     val title: String, | ||||
|     val timeAgo: String | ||||
| ) { | ||||
|     constructor(response: GetLatestFinishedLiveQueryResponse) : this( | ||||
|         response.memberId, | ||||
|         response.nickname, | ||||
|         response.profileImageUrl, | ||||
|         response.title, | ||||
|         response.updatedAt.getTimeAgoString() | ||||
|     ) | ||||
| } | ||||
|   | ||||
| @@ -60,7 +60,7 @@ interface LiveRoomQueryRepository { | ||||
|     fun getTotalHeartCount(roomId: Long): Int? | ||||
|     fun getLiveRoomCreatorId(roomId: Long): Long? | ||||
|     fun getHeartList(roomId: Long): List<GetLiveRoomHeartListItem> | ||||
|     fun getLatestFinishedLive(offset: Long): List<LiveRoom> | ||||
|     fun getLatestFinishedLive(offset: Long): List<GetLatestFinishedLiveQueryResponse> | ||||
| } | ||||
|  | ||||
| class LiveRoomQueryRepositoryImpl( | ||||
| @@ -382,9 +382,17 @@ class LiveRoomQueryRepositoryImpl( | ||||
|             .fetch() | ||||
|     } | ||||
|  | ||||
|     override fun getLatestFinishedLive(offset: Long): List<LiveRoom> { | ||||
|     override fun getLatestFinishedLive(offset: Long): List<GetLatestFinishedLiveQueryResponse> { | ||||
|         return queryFactory | ||||
|             .selectFrom(liveRoom) | ||||
|             .select( | ||||
|                 QGetLatestFinishedLiveQueryResponse( | ||||
|                     member.id, | ||||
|                     member.nickname, | ||||
|                     member.profileImage.prepend("/").prepend(cloudFrontHost), | ||||
|                     liveRoom.title, | ||||
|                     liveRoom.updatedAt.max() | ||||
|                 ) | ||||
|             ) | ||||
|             .innerJoin(liveRoom.member, member) | ||||
|             .where( | ||||
|                 liveRoom.isActive.isFalse | ||||
|   | ||||
| @@ -19,7 +19,6 @@ import kr.co.vividnext.sodalive.can.use.UseCanCalculateStatus | ||||
| import kr.co.vividnext.sodalive.common.SodaException | ||||
| import kr.co.vividnext.sodalive.explorer.ExplorerQueryRepository | ||||
| import kr.co.vividnext.sodalive.extensions.convertLocalDateTime | ||||
| import kr.co.vividnext.sodalive.extensions.getTimeAgoString | ||||
| import kr.co.vividnext.sodalive.fcm.FcmEvent | ||||
| import kr.co.vividnext.sodalive.fcm.FcmEventType | ||||
| import kr.co.vividnext.sodalive.live.reservation.LiveReservationRepository | ||||
| @@ -1307,19 +1306,13 @@ class LiveRoomService( | ||||
|                 repository.getLatestFinishedLive(offset = retry) | ||||
|                     .filter { | ||||
|                         if (member?.id != null) { | ||||
|                             !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) | ||||
|                             !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.memberId) | ||||
|                         } else { | ||||
|                             true | ||||
|                         } | ||||
|                     } | ||||
|                     .map { | ||||
|                         GetLatestFinishedLiveResponse( | ||||
|                             memberId = it.member!!.id!!, | ||||
|                             nickname = it.member!!.nickname, | ||||
|                             profileImageUrl = "$cloudFrontHost/${it.member!!.profileImage}", | ||||
|                             title = it.title, | ||||
|                             timeAgo = it.updatedAt!!.getTimeAgoString() | ||||
|                         ) | ||||
|                         GetLatestFinishedLiveResponse(response = it) | ||||
|                     } | ||||
|             ) | ||||
|         } while (result.size < 20 && retry++ < 3) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user