Compare commits
No commits in common. "858ce524f961654f945ea87ce32cfcbcc615800c" and "3795fb4a403af2317f61dee1db95a6e2a87ee0dd" have entirely different histories.
858ce524f9
...
3795fb4a40
|
@ -3,7 +3,6 @@ package kr.co.vividnext.sodalive.content.comment
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||||
import kr.co.vividnext.sodalive.content.comment.QAudioContentComment.audioContentComment
|
import kr.co.vividnext.sodalive.content.comment.QAudioContentComment.audioContentComment
|
||||||
import kr.co.vividnext.sodalive.member.QMember.member
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
|
@ -31,11 +30,7 @@ interface AudioContentCommentQueryRepository {
|
||||||
limit: Int
|
limit: Int
|
||||||
): List<GetAudioContentCommentListItem>
|
): List<GetAudioContentCommentListItem>
|
||||||
|
|
||||||
fun findPushTokenByContentIdAndCommentParentIdMyMemberId(
|
fun findPushTokenByContentCommentId(contentCommentId: Long): FindPushTokenByContentCommentIdResponse?
|
||||||
contentId: Long,
|
|
||||||
commentParentId: Long?,
|
|
||||||
myMemberId: Long
|
|
||||||
): List<FindPushTokenByContentIdAndCommentParentIdMyMemberIdResponse>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -148,49 +143,27 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findPushTokenByContentIdAndCommentParentIdMyMemberId(
|
override fun findPushTokenByContentCommentId(contentCommentId: Long): FindPushTokenByContentCommentIdResponse? {
|
||||||
contentId: Long,
|
val response = queryFactory
|
||||||
commentParentId: Long?,
|
.selectFrom(audioContentComment)
|
||||||
myMemberId: Long
|
.innerJoin(audioContentComment.audioContent, audioContent)
|
||||||
): List<FindPushTokenByContentIdAndCommentParentIdMyMemberIdResponse> {
|
.where(audioContentComment.id.eq(contentCommentId))
|
||||||
var where = audioContent.id.eq(contentId)
|
.fetchFirst()
|
||||||
.and(member.id.ne(myMemberId))
|
|
||||||
.and(audioContentComment.isActive.isTrue)
|
|
||||||
|
|
||||||
if (commentParentId != null) {
|
return if (response == null) {
|
||||||
where = where.and(
|
null
|
||||||
audioContentComment.parent.id.eq(commentParentId)
|
|
||||||
.or(audioContentComment.id.eq(commentParentId))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val response = if (commentParentId != null) {
|
|
||||||
queryFactory
|
|
||||||
.select(
|
|
||||||
QFindPushTokenByContentIdAndCommentParentIdMyMemberIdResponse(
|
|
||||||
member.pushToken.coalesce(""),
|
|
||||||
member.container
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.from(audioContentComment)
|
|
||||||
.innerJoin(audioContentComment.audioContent, audioContent)
|
|
||||||
.innerJoin(audioContentComment.member, member)
|
|
||||||
.where(where)
|
|
||||||
.fetch()
|
|
||||||
} else {
|
} else {
|
||||||
queryFactory
|
if (response.parent != null) {
|
||||||
.select(
|
FindPushTokenByContentCommentIdResponse(
|
||||||
QFindPushTokenByContentIdAndCommentParentIdMyMemberIdResponse(
|
pushToken = response.parent!!.member!!.pushToken ?: "",
|
||||||
member.pushToken.coalesce(""),
|
container = response.parent!!.member!!.container
|
||||||
member.container
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.from(audioContent)
|
} else {
|
||||||
.innerJoin(audioContent.member, member)
|
FindPushTokenByContentCommentIdResponse(
|
||||||
.where(where)
|
pushToken = response.audioContent!!.member!!.pushToken ?: "",
|
||||||
.fetch()
|
container = response.audioContent!!.member!!.container
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,7 @@ class AudioContentCommentService(
|
||||||
"콘텐츠에 댓글을 달았습니다.: ${audioContent.title}"
|
"콘텐츠에 댓글을 달았습니다.: ${audioContent.title}"
|
||||||
},
|
},
|
||||||
contentId = audioContentId,
|
contentId = audioContentId,
|
||||||
commentParentId = parentId,
|
contentCommentId = audioContentComment.id!!
|
||||||
myMemberId = member.id
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package kr.co.vividnext.sodalive.content.comment
|
||||||
|
|
||||||
|
data class FindPushTokenByContentCommentIdResponse(
|
||||||
|
val pushToken: String,
|
||||||
|
val container: String
|
||||||
|
)
|
|
@ -1,8 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.content.comment
|
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
|
||||||
|
|
||||||
data class FindPushTokenByContentIdAndCommentParentIdMyMemberIdResponse @QueryProjection constructor(
|
|
||||||
val pushToken: String,
|
|
||||||
val container: String
|
|
||||||
)
|
|
|
@ -25,8 +25,7 @@ class FcmEvent(
|
||||||
val contentId: Long? = null,
|
val contentId: Long? = null,
|
||||||
val messageId: Long? = null,
|
val messageId: Long? = null,
|
||||||
val creatorId: Long? = null,
|
val creatorId: Long? = null,
|
||||||
val commentParentId: Long? = null,
|
val contentCommentId: Long? = null
|
||||||
val myMemberId: Long? = null
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -229,45 +228,17 @@ class FcmSendListener(
|
||||||
}
|
}
|
||||||
|
|
||||||
FcmEventType.CREATE_CONTENT_COMMENT -> {
|
FcmEventType.CREATE_CONTENT_COMMENT -> {
|
||||||
if (fcmEvent.myMemberId != null && fcmEvent.contentId != null) {
|
if (fcmEvent.contentCommentId != null && fcmEvent.contentId != null) {
|
||||||
val response = contentCommentRepository.findPushTokenByContentIdAndCommentParentIdMyMemberId(
|
val response = contentCommentRepository.findPushTokenByContentCommentId(
|
||||||
contentId = fcmEvent.contentId,
|
contentCommentId = fcmEvent.contentCommentId
|
||||||
commentParentId = fcmEvent.commentParentId,
|
|
||||||
myMemberId = fcmEvent.myMemberId
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val iosPushTokens = response
|
if (response != null) {
|
||||||
.asSequence()
|
|
||||||
.distinct()
|
|
||||||
.filter { it.pushToken.isNotBlank() }
|
|
||||||
.filter { it.container == "ios" }
|
|
||||||
.map { it.pushToken }
|
|
||||||
.toList()
|
|
||||||
|
|
||||||
val aosPushTokens = response
|
|
||||||
.asSequence()
|
|
||||||
.distinct()
|
|
||||||
.filter { it.pushToken.isNotBlank() }
|
|
||||||
.filter { it.container == "aos" }
|
|
||||||
.map { it.pushToken }
|
|
||||||
.toList()
|
|
||||||
|
|
||||||
if (iosPushTokens.isNotEmpty()) {
|
|
||||||
pushService.send(
|
pushService.send(
|
||||||
tokens = iosPushTokens,
|
tokens = listOf(response.pushToken),
|
||||||
title = fcmEvent.title,
|
title = fcmEvent.title,
|
||||||
message = fcmEvent.message,
|
message = fcmEvent.message,
|
||||||
container = "ios",
|
container = response.container,
|
||||||
contentId = fcmEvent.contentId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aosPushTokens.isNotEmpty()) {
|
|
||||||
pushService.send(
|
|
||||||
tokens = aosPushTokens,
|
|
||||||
title = fcmEvent.title,
|
|
||||||
message = fcmEvent.message,
|
|
||||||
container = "aos",
|
|
||||||
contentId = fcmEvent.contentId
|
contentId = fcmEvent.contentId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue