크리에이터 프로필 API

- 알림과 팔로우 상태값 분리
This commit is contained in:
Klaus 2024-09-13 12:02:43 +09:00
parent 10f484357c
commit 9516ce1c0f
4 changed files with 23 additions and 2 deletions

View File

@ -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
)

View File

@ -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)

View File

@ -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,

View File

@ -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)