test #6
| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.fcm | ||||
|  | ||||
| import com.google.firebase.messaging.FirebaseMessaging | ||||
| import com.google.firebase.messaging.MulticastMessage | ||||
| import com.google.firebase.messaging.Notification | ||||
| import org.springframework.scheduling.annotation.Async | ||||
| import org.springframework.stereotype.Service | ||||
|  | ||||
| @@ -18,10 +19,22 @@ class FcmService { | ||||
|         contentId: Long? = null | ||||
|     ) { | ||||
|         val multicastMessage = MulticastMessage.builder() | ||||
|             .putData("title", title) | ||||
|             .putData("message", message) | ||||
|             .addAllTokens(tokens) | ||||
|  | ||||
|         if (container == "ios") { | ||||
|             multicastMessage | ||||
|                 .setNotification( | ||||
|                     Notification.builder() | ||||
|                         .setTitle(title) | ||||
|                         .setBody(message) | ||||
|                         .build() | ||||
|                 ) | ||||
|         } else { | ||||
|             multicastMessage | ||||
|                 .putData("title", title) | ||||
|                 .putData("message", message) | ||||
|         } | ||||
|  | ||||
|         if (roomId != null) { | ||||
|             multicastMessage.putData("room_id", roomId.toString()) | ||||
|         } | ||||
|   | ||||
| @@ -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 | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -672,6 +672,7 @@ class LiveRoomService( | ||||
|                 "$cloudFrontHost/profile/default-profile.png" | ||||
|             }, | ||||
|             isFollowing = isFollowing, | ||||
|             isAdult = room.isAdult, | ||||
|             participantsCount = roomInfo.listenerCount + roomInfo.speakerCount + roomInfo.managerCount, | ||||
|             totalAvailableParticipantsCount = room.numberOfPeople, | ||||
|             speakerList = roomInfo.speakerList, | ||||
|   | ||||
| @@ -12,6 +12,7 @@ data class GetRoomInfoResponse( | ||||
|     val creatorNickname: String, | ||||
|     val creatorProfileUrl: String, | ||||
|     val isFollowing: Boolean, | ||||
|     val isAdult: Boolean, | ||||
|     val participantsCount: Int, | ||||
|     val totalAvailableParticipantsCount: Int, | ||||
|     val speakerList: List<LiveRoomMember>, | ||||
|   | ||||
| @@ -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