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