Merge pull request '주문목록 - 크리에이터 닉네임 추가' (#29) from test into main
Reviewed-on: #29
This commit is contained in:
commit
f4618877d4
|
@ -67,18 +67,19 @@ class AudioContentCommentService(
|
|||
val audioContentComment = repository.findByIdOrNull(request.commentId)
|
||||
?: throw SodaException("잘못된 접근 입니다.\n확인 후 다시 시도해 주세요.")
|
||||
|
||||
if (audioContentComment.audioContent!!.member!!.id!! != member.id!!) {
|
||||
if (audioContentComment.member == null || audioContentComment.member!!.id!! != member.id!!) {
|
||||
throw SodaException("잘못된 접근 입니다.\n확인 후 다시 시도해 주세요.")
|
||||
}
|
||||
|
||||
if (audioContentComment.member!!.id!! == member.id!!) {
|
||||
if (request.comment != null) {
|
||||
audioContentComment.comment = request.comment
|
||||
}
|
||||
}
|
||||
|
||||
if (request.isActive != null) {
|
||||
audioContentComment.isActive = request.isActive
|
||||
if (
|
||||
audioContentComment.member!!.id!! == member.id!! ||
|
||||
audioContentComment.audioContent!!.member!!.id!! != member.id!!
|
||||
) {
|
||||
if (request.isActive != null) {
|
||||
audioContentComment.isActive = request.isActive
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ data class GetAudioContentOrderListResponse(
|
|||
data class GetAudioContentOrderListItem @QueryProjection constructor(
|
||||
val contentId: Long,
|
||||
val coverImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val themeStr: String,
|
||||
val duration: String?,
|
||||
|
|
|
@ -126,6 +126,7 @@ class OrderQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : Orde
|
|||
QGetAudioContentOrderListItem(
|
||||
audioContent.id,
|
||||
audioContent.coverImage.prepend("/").prepend(coverImageHost),
|
||||
audioContent.member.nickname,
|
||||
audioContent.title,
|
||||
audioContent.theme.theme,
|
||||
audioContent.duration,
|
||||
|
|
|
@ -451,6 +451,7 @@ class ExplorerQueryRepository(
|
|||
|
||||
GetCheersResponseItem(
|
||||
cheersId = it.id!!,
|
||||
memberId = it.member!!.id!!,
|
||||
nickname = it.member!!.nickname,
|
||||
profileUrl = if (it.member!!.profileImage != null) {
|
||||
"$cloudFrontHost/${it.member!!.profileImage}"
|
||||
|
@ -467,6 +468,7 @@ class ExplorerQueryRepository(
|
|||
|
||||
GetCheersResponseItem(
|
||||
cheersId = cheers.id!!,
|
||||
memberId = cheers.member!!.id!!,
|
||||
nickname = cheers.member!!.nickname,
|
||||
profileUrl = if (cheers.member!!.profileImage != null) {
|
||||
"$cloudFrontHost/${cheers.member!!.profileImage}"
|
||||
|
@ -593,13 +595,10 @@ class ExplorerQueryRepository(
|
|||
.fetchFirst()
|
||||
}
|
||||
|
||||
fun getCheers(cheersId: Long, memberId: Long): CreatorCheers? {
|
||||
fun getCheers(cheersId: Long): CreatorCheers? {
|
||||
return queryFactory
|
||||
.selectFrom(creatorCheers)
|
||||
.where(
|
||||
creatorCheers.id.eq(cheersId)
|
||||
.and(creatorCheers.member.id.eq(memberId))
|
||||
)
|
||||
.where(creatorCheers.id.eq(cheersId))
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
|
|
|
@ -368,10 +368,23 @@ class ExplorerService(
|
|||
|
||||
@Transactional
|
||||
fun modifyCheers(request: PutWriteCheersRequest, member: Member) {
|
||||
val cheers = queryRepository.getCheers(request.cheersId, member.id!!)
|
||||
val cheers = queryRepository.getCheers(request.cheersId)
|
||||
?: throw SodaException("잘못된 요청입니다.")
|
||||
|
||||
cheers.cheers = request.content
|
||||
if (cheers.member!!.id!! == member.id!!) {
|
||||
if (request.content != null) {
|
||||
cheers.cheers = request.content
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
cheers.creator!!.id!! == member.id!! ||
|
||||
cheers.member!!.id!! == member.id!!
|
||||
) {
|
||||
if (request.isActive != null) {
|
||||
cheers.isActive = request.isActive
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
@ -7,6 +7,7 @@ data class GetCheersResponse(
|
|||
|
||||
data class GetCheersResponseItem(
|
||||
val cheersId: Long,
|
||||
val memberId: Long,
|
||||
val nickname: String,
|
||||
val profileUrl: String,
|
||||
val content: String,
|
||||
|
|
|
@ -13,7 +13,7 @@ import javax.persistence.OneToMany
|
|||
data class CreatorCheers(
|
||||
@Column(columnDefinition = "TEXT", nullable = false)
|
||||
var cheers: String,
|
||||
val isActive: Boolean = true
|
||||
var isActive: Boolean = true
|
||||
) : BaseEntity() {
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parent_id", nullable = true)
|
||||
|
|
|
@ -2,5 +2,6 @@ package kr.co.vividnext.sodalive.explorer.profile
|
|||
|
||||
data class PutWriteCheersRequest(
|
||||
val cheersId: Long,
|
||||
val content: String
|
||||
val content: String? = null,
|
||||
val isActive: Boolean? = null
|
||||
)
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.fcm
|
|||
|
||||
import kr.co.vividnext.sodalive.content.comment.AudioContentCommentRepository
|
||||
import kr.co.vividnext.sodalive.member.MemberRepository
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.scheduling.annotation.Async
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.transaction.annotation.Propagation
|
||||
|
@ -34,6 +35,8 @@ class FcmSendListener(
|
|||
private val memberRepository: MemberRepository,
|
||||
private val contentCommentRepository: AudioContentCommentRepository
|
||||
) {
|
||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||
|
||||
@Async
|
||||
@TransactionalEventListener
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
|
@ -117,10 +120,12 @@ class FcmSendListener(
|
|||
if (fcmEvent.container.isNotBlank()) {
|
||||
val pushTokens = memberRepository.getStartLiveRoomNotificationRecipientPushTokens(
|
||||
creatorId = fcmEvent.creatorId!!,
|
||||
roomId = fcmEvent.roomId!!,
|
||||
isAuth = fcmEvent.isAuth,
|
||||
container = fcmEvent.container
|
||||
)
|
||||
|
||||
logger.info("토큰 - $pushTokens")
|
||||
for (tokens in pushTokens) {
|
||||
pushService.send(
|
||||
tokens = tokens,
|
||||
|
|
|
@ -250,7 +250,7 @@ class LiveRoomService(
|
|||
message = if (createdRoom.channelName != null) {
|
||||
"라이브를 시작했습니다. - ${createdRoom.title}"
|
||||
} else {
|
||||
"라이브를 개설했습니다. - ${createdRoom.title}"
|
||||
"라이브를 예약했습니다. - ${createdRoom.title}"
|
||||
},
|
||||
isAuth = createdRoom.isAdult,
|
||||
roomId = createdRoom.id,
|
||||
|
@ -266,7 +266,7 @@ class LiveRoomService(
|
|||
message = if (createdRoom.channelName != null) {
|
||||
"라이브를 시작했습니다. - ${createdRoom.title}"
|
||||
} else {
|
||||
"라이브를 개설했습니다. - ${createdRoom.title}"
|
||||
"라이브를 예약했습니다. - ${createdRoom.title}"
|
||||
},
|
||||
isAuth = createdRoom.isAdult,
|
||||
roomId = createdRoom.id,
|
||||
|
|
|
@ -34,6 +34,7 @@ interface MemberQueryRepository {
|
|||
|
||||
fun getStartLiveRoomNotificationRecipientPushTokens(
|
||||
creatorId: Long,
|
||||
roomId: Long,
|
||||
isAuth: Boolean,
|
||||
container: String
|
||||
): List<List<String>>
|
||||
|
@ -146,12 +147,10 @@ class MemberQueryRepositoryImpl(
|
|||
|
||||
override fun getStartLiveRoomNotificationRecipientPushTokens(
|
||||
creatorId: Long,
|
||||
roomId: Long,
|
||||
isAuth: Boolean,
|
||||
container: String
|
||||
): List<List<String>> {
|
||||
val member = QMember.member
|
||||
val creator = QMember.member
|
||||
|
||||
var where = creatorFollowing.isActive.isTrue
|
||||
.and(creatorFollowing.creator.id.eq(creatorId))
|
||||
.and(creatorFollowing.member.notification.live.isTrue)
|
||||
|
@ -165,26 +164,21 @@ class MemberQueryRepositoryImpl(
|
|||
.and(creatorFollowing.member.pushToken.isNotNull)
|
||||
|
||||
if (isAuth) {
|
||||
where = where.and(member.auth.isNotNull)
|
||||
where = where.and(creatorFollowing.member.auth.isNotNull)
|
||||
}
|
||||
|
||||
val followingMemberPushToken = queryFactory
|
||||
.select(creatorFollowing.member.pushToken)
|
||||
.from(creatorFollowing)
|
||||
.innerJoin(creatorFollowing.creator, creator)
|
||||
.innerJoin(creatorFollowing.member, member)
|
||||
.innerJoin(member.notification, memberNotification)
|
||||
.leftJoin(member.auth, auth)
|
||||
.where(where)
|
||||
.fetch()
|
||||
.toSet()
|
||||
.chunked(500)
|
||||
|
||||
where = liveReservation.isActive.isTrue
|
||||
.and(liveReservation.member.notification.live.isTrue)
|
||||
.and(liveReservation.member.container.eq(container))
|
||||
.and(liveReservation.member.email.notIn("admin@sodalive.net"))
|
||||
.and(liveReservation.member.pushToken.isNotNull)
|
||||
.and(liveReservation.room.id.eq(roomId))
|
||||
.and(
|
||||
liveReservation.member.id.notIn(
|
||||
blockMemberRepository.getBlockedMemberList(creatorId)
|
||||
|
@ -192,21 +186,18 @@ class MemberQueryRepositoryImpl(
|
|||
)
|
||||
|
||||
if (isAuth) {
|
||||
where = where.and(member.auth.isNotNull)
|
||||
where = where.and(liveReservation.member.auth.isNotNull)
|
||||
}
|
||||
|
||||
val reservationMemberPushToken = queryFactory
|
||||
.select(liveReservation.member.pushToken)
|
||||
.from(liveReservation)
|
||||
.innerJoin(liveReservation.member, member)
|
||||
.innerJoin(liveReservation.room, liveRoom)
|
||||
.innerJoin(liveRoom.member, creator)
|
||||
.where(where)
|
||||
.fetch()
|
||||
|
||||
return (followingMemberPushToken + reservationMemberPushToken)
|
||||
.toSet()
|
||||
.chunked(500)
|
||||
|
||||
return followingMemberPushToken + reservationMemberPushToken
|
||||
}
|
||||
|
||||
override fun getUploadContentNotificationRecipientPushTokens(
|
||||
|
|
Loading…
Reference in New Issue