test #6
| @@ -25,6 +25,8 @@ interface LiveReservationQueryRepository { | ||||
|         reservationId: Long, | ||||
|         memberId: Long | ||||
|     ): LiveReservation? | ||||
|  | ||||
|     fun getReservationCount(memberId: Long): Int | ||||
| } | ||||
|  | ||||
| @Repository | ||||
| @@ -97,4 +99,16 @@ class LiveReservationQueryRepositoryImpl(private val queryFactory: JPAQueryFacto | ||||
|             ) | ||||
|             .fetchFirst() | ||||
|     } | ||||
|  | ||||
|     override fun getReservationCount(memberId: Long): Int { | ||||
|         return queryFactory | ||||
|             .selectFrom(liveReservation) | ||||
|             .where( | ||||
|                 liveReservation.member.id.eq(memberId) | ||||
|                     .and(liveReservation.isActive.isTrue) | ||||
|                     .and(liveReservation.room.isActive.isTrue) | ||||
|             ) | ||||
|             .fetch() | ||||
|             .size | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -7,8 +7,10 @@ import kr.co.vividnext.sodalive.can.payment.CanPaymentService | ||||
| import kr.co.vividnext.sodalive.can.use.CanUsage | ||||
| import kr.co.vividnext.sodalive.common.ApiResponse | ||||
| import kr.co.vividnext.sodalive.common.SodaException | ||||
| import kr.co.vividnext.sodalive.content.order.OrderService | ||||
| import kr.co.vividnext.sodalive.email.SendEmailService | ||||
| import kr.co.vividnext.sodalive.jwt.TokenProvider | ||||
| import kr.co.vividnext.sodalive.live.reservation.LiveReservationRepository | ||||
| import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailUser | ||||
| import kr.co.vividnext.sodalive.member.block.BlockMember | ||||
| import kr.co.vividnext.sodalive.member.block.BlockMemberRepository | ||||
| @@ -66,7 +68,9 @@ class MemberService( | ||||
|     private val signOutRepository: SignOutRepository, | ||||
|     private val nicknameChangeLogRepository: NicknameChangeLogRepository, | ||||
|     private val memberTagRepository: MemberTagRepository, | ||||
|     private val liveReservationRepository: LiveReservationRepository, | ||||
|  | ||||
|     private val orderService: OrderService, | ||||
|     private val emailService: SendEmailService, | ||||
|     private val canPaymentService: CanPaymentService, | ||||
|     private val memberNotificationService: MemberNotificationService, | ||||
| @@ -165,6 +169,14 @@ class MemberService( | ||||
|     } | ||||
|  | ||||
|     fun getMyPage(member: Member, container: String): MyPageResponse { | ||||
|         val liveReservationCount = liveReservationRepository.getReservationCount(memberId = member.id!!) | ||||
|  | ||||
|         val orderList = orderService.getAudioContentOrderList( | ||||
|             member = member, | ||||
|             offset = 0, | ||||
|             limit = 4 | ||||
|         ) | ||||
|  | ||||
|         return MyPageResponse( | ||||
|             nickname = member.nickname, | ||||
|             profileUrl = if (member.profileImage != null) { | ||||
| @@ -178,8 +190,9 @@ class MemberService( | ||||
|             instagramUrl = member.instagramUrl, | ||||
|             websiteUrl = member.websiteUrl, | ||||
|             blogUrl = member.blogUrl, | ||||
|             liveReservationCount = 0, | ||||
|             isAuth = member.auth != null | ||||
|             liveReservationCount = liveReservationCount, | ||||
|             isAuth = member.auth != null, | ||||
|             orderList = orderList | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,7 @@ | ||||
| package kr.co.vividnext.sodalive.member.myPage | ||||
|  | ||||
| import kr.co.vividnext.sodalive.content.order.GetAudioContentOrderListResponse | ||||
|  | ||||
| data class MyPageResponse( | ||||
|     val nickname: String, | ||||
|     val profileUrl: String, | ||||
| @@ -10,5 +12,6 @@ data class MyPageResponse( | ||||
|     val websiteUrl: String? = null, | ||||
|     val blogUrl: String? = null, | ||||
|     val liveReservationCount: Int, | ||||
|     val isAuth: Boolean | ||||
|     val isAuth: Boolean, | ||||
|     val orderList: GetAudioContentOrderListResponse | ||||
| ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user