parent
10f484357c
commit
9516ce1c0f
|
@ -10,6 +10,8 @@ data class CreatorResponse(
|
|||
val youtubeUrl: String? = null,
|
||||
val websiteUrl: String? = null,
|
||||
val blogUrl: String? = null,
|
||||
val isFollow: Boolean,
|
||||
val isNotify: Boolean,
|
||||
val isNotification: Boolean,
|
||||
val notificationRecipientCount: Int
|
||||
)
|
||||
|
|
|
@ -46,6 +46,18 @@ class ExplorerQueryRepository(
|
|||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val cloudFrontHost: String
|
||||
) {
|
||||
fun getCreatorFollowing(creatorId: Long, memberId: Long): GetCreatorFollowingResponse {
|
||||
return queryFactory
|
||||
.select(QGetCreatorFollowingResponse(creatorFollowing.isActive, creatorFollowing.isNotify))
|
||||
.from(creatorFollowing)
|
||||
.where(
|
||||
creatorFollowing.isActive.isTrue
|
||||
.and(creatorFollowing.creator.id.eq(creatorId))
|
||||
.and(creatorFollowing.member.id.eq(memberId))
|
||||
)
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
fun getNotificationUserIds(creatorId: Long): List<Long> {
|
||||
return queryFactory
|
||||
.select(creatorFollowing.member.id)
|
||||
|
|
|
@ -145,7 +145,7 @@ class ExplorerService(
|
|||
if (isBlocked) throw SodaException("${creatorAccount.nickname}님의 요청으로 채널 접근이 제한됩니다.")
|
||||
|
||||
val notificationUserIds = queryRepository.getNotificationUserIds(creatorId)
|
||||
val isNotification = notificationUserIds.contains(member.id)
|
||||
val creatorFollowing = queryRepository.getCreatorFollowing(creatorId = creatorId, memberId = member.id!!)
|
||||
val notificationRecipientCount = notificationUserIds.size
|
||||
|
||||
// 후원랭킹
|
||||
|
@ -223,7 +223,9 @@ class ExplorerService(
|
|||
youtubeUrl = creatorAccount.youtubeUrl,
|
||||
websiteUrl = creatorAccount.websiteUrl,
|
||||
blogUrl = creatorAccount.blogUrl,
|
||||
isNotification = isNotification,
|
||||
isFollow = creatorFollowing.isFollow,
|
||||
isNotify = creatorFollowing.isNotify,
|
||||
isNotification = creatorFollowing.isFollow,
|
||||
notificationRecipientCount = notificationRecipientCount
|
||||
),
|
||||
userDonationRanking = memberDonationRanking,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package kr.co.vividnext.sodalive.explorer
|
||||
|
||||
import com.querydsl.core.annotations.QueryProjection
|
||||
|
||||
data class GetCreatorFollowingResponse @QueryProjection constructor(val isFollow: Boolean, val isNotify: Boolean)
|
Loading…
Reference in New Issue