test #6
| @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.fcm | |||||||
|  |  | ||||||
| import com.google.firebase.messaging.FirebaseMessaging | import com.google.firebase.messaging.FirebaseMessaging | ||||||
| import com.google.firebase.messaging.MulticastMessage | import com.google.firebase.messaging.MulticastMessage | ||||||
|  | import com.google.firebase.messaging.Notification | ||||||
| import org.springframework.scheduling.annotation.Async | import org.springframework.scheduling.annotation.Async | ||||||
| import org.springframework.stereotype.Service | import org.springframework.stereotype.Service | ||||||
|  |  | ||||||
| @@ -18,9 +19,21 @@ class FcmService { | |||||||
|         contentId: Long? = null |         contentId: Long? = null | ||||||
|     ) { |     ) { | ||||||
|         val multicastMessage = MulticastMessage.builder() |         val multicastMessage = MulticastMessage.builder() | ||||||
|  |             .addAllTokens(tokens) | ||||||
|  |  | ||||||
|  |         if (container == "ios") { | ||||||
|  |             multicastMessage | ||||||
|  |                 .setNotification( | ||||||
|  |                     Notification.builder() | ||||||
|  |                         .setTitle(title) | ||||||
|  |                         .setBody(message) | ||||||
|  |                         .build() | ||||||
|  |                 ) | ||||||
|  |         } else { | ||||||
|  |             multicastMessage | ||||||
|                 .putData("title", title) |                 .putData("title", title) | ||||||
|                 .putData("message", message) |                 .putData("message", message) | ||||||
|             .addAllTokens(tokens) |         } | ||||||
|  |  | ||||||
|         if (roomId != null) { |         if (roomId != null) { | ||||||
|             multicastMessage.putData("room_id", roomId.toString()) |             multicastMessage.putData("room_id", roomId.toString()) | ||||||
|   | |||||||
| @@ -25,6 +25,8 @@ interface LiveReservationQueryRepository { | |||||||
|         reservationId: Long, |         reservationId: Long, | ||||||
|         memberId: Long |         memberId: Long | ||||||
|     ): LiveReservation? |     ): LiveReservation? | ||||||
|  |  | ||||||
|  |     fun getReservationCount(memberId: Long): Int | ||||||
| } | } | ||||||
|  |  | ||||||
| @Repository | @Repository | ||||||
| @@ -97,4 +99,16 @@ class LiveReservationQueryRepositoryImpl(private val queryFactory: JPAQueryFacto | |||||||
|             ) |             ) | ||||||
|             .fetchFirst() |             .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" |                 "$cloudFrontHost/profile/default-profile.png" | ||||||
|             }, |             }, | ||||||
|             isFollowing = isFollowing, |             isFollowing = isFollowing, | ||||||
|  |             isAdult = room.isAdult, | ||||||
|             participantsCount = roomInfo.listenerCount + roomInfo.speakerCount + roomInfo.managerCount, |             participantsCount = roomInfo.listenerCount + roomInfo.speakerCount + roomInfo.managerCount, | ||||||
|             totalAvailableParticipantsCount = room.numberOfPeople, |             totalAvailableParticipantsCount = room.numberOfPeople, | ||||||
|             speakerList = roomInfo.speakerList, |             speakerList = roomInfo.speakerList, | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ data class GetRoomInfoResponse( | |||||||
|     val creatorNickname: String, |     val creatorNickname: String, | ||||||
|     val creatorProfileUrl: String, |     val creatorProfileUrl: String, | ||||||
|     val isFollowing: Boolean, |     val isFollowing: Boolean, | ||||||
|  |     val isAdult: Boolean, | ||||||
|     val participantsCount: Int, |     val participantsCount: Int, | ||||||
|     val totalAvailableParticipantsCount: Int, |     val totalAvailableParticipantsCount: Int, | ||||||
|     val speakerList: List<LiveRoomMember>, |     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.can.use.CanUsage | ||||||
| import kr.co.vividnext.sodalive.common.ApiResponse | import kr.co.vividnext.sodalive.common.ApiResponse | ||||||
| import kr.co.vividnext.sodalive.common.SodaException | 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.email.SendEmailService | ||||||
| import kr.co.vividnext.sodalive.jwt.TokenProvider | 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.live.room.detail.GetRoomDetailUser | ||||||
| import kr.co.vividnext.sodalive.member.block.BlockMember | import kr.co.vividnext.sodalive.member.block.BlockMember | ||||||
| import kr.co.vividnext.sodalive.member.block.BlockMemberRepository | import kr.co.vividnext.sodalive.member.block.BlockMemberRepository | ||||||
| @@ -66,7 +68,9 @@ class MemberService( | |||||||
|     private val signOutRepository: SignOutRepository, |     private val signOutRepository: SignOutRepository, | ||||||
|     private val nicknameChangeLogRepository: NicknameChangeLogRepository, |     private val nicknameChangeLogRepository: NicknameChangeLogRepository, | ||||||
|     private val memberTagRepository: MemberTagRepository, |     private val memberTagRepository: MemberTagRepository, | ||||||
|  |     private val liveReservationRepository: LiveReservationRepository, | ||||||
|  |  | ||||||
|  |     private val orderService: OrderService, | ||||||
|     private val emailService: SendEmailService, |     private val emailService: SendEmailService, | ||||||
|     private val canPaymentService: CanPaymentService, |     private val canPaymentService: CanPaymentService, | ||||||
|     private val memberNotificationService: MemberNotificationService, |     private val memberNotificationService: MemberNotificationService, | ||||||
| @@ -165,6 +169,14 @@ class MemberService( | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun getMyPage(member: Member, container: String): MyPageResponse { |     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( |         return MyPageResponse( | ||||||
|             nickname = member.nickname, |             nickname = member.nickname, | ||||||
|             profileUrl = if (member.profileImage != null) { |             profileUrl = if (member.profileImage != null) { | ||||||
| @@ -178,8 +190,9 @@ class MemberService( | |||||||
|             instagramUrl = member.instagramUrl, |             instagramUrl = member.instagramUrl, | ||||||
|             websiteUrl = member.websiteUrl, |             websiteUrl = member.websiteUrl, | ||||||
|             blogUrl = member.blogUrl, |             blogUrl = member.blogUrl, | ||||||
|             liveReservationCount = 0, |             liveReservationCount = liveReservationCount, | ||||||
|             isAuth = member.auth != null |             isAuth = member.auth != null, | ||||||
|  |             orderList = orderList | ||||||
|         ) |         ) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| package kr.co.vividnext.sodalive.member.myPage | package kr.co.vividnext.sodalive.member.myPage | ||||||
|  |  | ||||||
|  | import kr.co.vividnext.sodalive.content.order.GetAudioContentOrderListResponse | ||||||
|  |  | ||||||
| data class MyPageResponse( | data class MyPageResponse( | ||||||
|     val nickname: String, |     val nickname: String, | ||||||
|     val profileUrl: String, |     val profileUrl: String, | ||||||
| @@ -10,5 +12,6 @@ data class MyPageResponse( | |||||||
|     val websiteUrl: String? = null, |     val websiteUrl: String? = null, | ||||||
|     val blogUrl: String? = null, |     val blogUrl: String? = null, | ||||||
|     val liveReservationCount: Int, |     val liveReservationCount: Int, | ||||||
|     val isAuth: Boolean |     val isAuth: Boolean, | ||||||
|  |     val orderList: GetAudioContentOrderListResponse | ||||||
| ) | ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user