크리에이터 프로필 API
- 랭킹, 추천 크리, 라이브, 콘텐츠, 시리즈, 커뮤니티, 활동요약을 크리에이터인 경우에만 조회하도록 수정
This commit is contained in:
parent
354fbf7e29
commit
eb36313c9b
|
@ -144,12 +144,16 @@ class ExplorerService(
|
|||
val isBlocked = memberService.isBlocked(blockedMemberId = member.id!!, memberId = creatorId)
|
||||
if (isBlocked) throw SodaException("${creatorAccount.nickname}님의 요청으로 채널 접근이 제한됩니다.")
|
||||
|
||||
val isCreator = creatorAccount.role == MemberRole.CREATOR
|
||||
|
||||
val notificationUserIds = queryRepository.getNotificationUserIds(creatorId)
|
||||
val creatorFollowing = queryRepository.getCreatorFollowing(creatorId = creatorId, memberId = member.id!!)
|
||||
val notificationRecipientCount = notificationUserIds.size
|
||||
|
||||
// 후원랭킹
|
||||
val memberDonationRanking = if (creatorId == member.id!! || creatorAccount.isVisibleDonationRank) {
|
||||
val memberDonationRanking = if (
|
||||
isCreator && (creatorId == member.id!! || creatorAccount.isVisibleDonationRank)
|
||||
) {
|
||||
queryRepository.getMemberDonationRanking(
|
||||
creatorId,
|
||||
10,
|
||||
|
@ -160,30 +164,47 @@ class ExplorerService(
|
|||
}
|
||||
|
||||
// 추천 크리에이터
|
||||
val similarCreatorList = queryRepository.getSimilarCreatorList(creatorId)
|
||||
val similarCreatorList = if (isCreator) {
|
||||
queryRepository.getSimilarCreatorList(creatorId)
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
|
||||
// 라이브
|
||||
val liveRoomList = queryRepository.getLiveRoomList(
|
||||
val liveRoomList = if (isCreator) {
|
||||
queryRepository.getLiveRoomList(
|
||||
creatorId,
|
||||
userMember = member,
|
||||
timezone = timezone,
|
||||
limit = 3
|
||||
)
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
|
||||
// 오디오 콘텐츠
|
||||
val contentList = audioContentService.getAudioContentList(
|
||||
val contentList = if (isCreator) {
|
||||
audioContentService.getAudioContentList(
|
||||
creatorId = creatorId,
|
||||
sortType = SortType.NEWEST,
|
||||
member = member,
|
||||
offset = 0,
|
||||
limit = 3
|
||||
).items
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
|
||||
// 공지사항
|
||||
val notice = queryRepository.getNoticeString(creatorId)
|
||||
val notice = if (isCreator) {
|
||||
queryRepository.getNoticeString(creatorId)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
// 커뮤니티
|
||||
val communityPostList = communityService.getCommunityPostList(
|
||||
val communityPostList = if (isCreator) {
|
||||
communityService.getCommunityPostList(
|
||||
creatorId = creatorId,
|
||||
memberId = member.id!!,
|
||||
timezone = timezone,
|
||||
|
@ -191,6 +212,9 @@ class ExplorerService(
|
|||
limit = 3,
|
||||
isAdult = member.auth != null
|
||||
)
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
|
||||
// 응원
|
||||
val cheers = queryRepository.getCheersList(creatorId, timezone = timezone, offset = 0, limit = 4)
|
||||
|
@ -198,15 +222,29 @@ class ExplorerService(
|
|||
// 차단한 크리에이터 인지 체크
|
||||
val isBlock = memberService.isBlocked(blockedMemberId = creatorId, memberId = member.id!!)
|
||||
|
||||
val activitySummary = if (isCreator) {
|
||||
// 활동요약 (라이브 횟수, 라이브 시간, 라이브 참여자, 콘텐츠 수)
|
||||
val liveCount = queryRepository.getLiveCount(creatorId) ?: 0
|
||||
val liveTime = queryRepository.getLiveTime(creatorId)
|
||||
val liveContributorCount = queryRepository.getLiveContributorCount(creatorId) ?: 0
|
||||
val contentCount = queryRepository.getContentCount(creatorId) ?: 0
|
||||
GetCreatorActivitySummary(
|
||||
liveCount = liveCount,
|
||||
liveTime = liveTime,
|
||||
liveContributorCount = liveContributorCount,
|
||||
contentCount = contentCount
|
||||
)
|
||||
} else {
|
||||
GetCreatorActivitySummary(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
val seriesList = seriesService
|
||||
val seriesList = if (isCreator) {
|
||||
seriesService
|
||||
.getSeriesList(creatorId = creatorId, member = member)
|
||||
.items
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
|
||||
return GetCreatorProfileResponse(
|
||||
creator = CreatorResponse(
|
||||
|
@ -235,14 +273,10 @@ class ExplorerService(
|
|||
notice = notice,
|
||||
communityPostList = communityPostList,
|
||||
cheers = cheers,
|
||||
activitySummary = GetCreatorActivitySummary(
|
||||
liveCount = liveCount,
|
||||
liveTime = liveTime,
|
||||
liveContributorCount = liveContributorCount,
|
||||
contentCount = contentCount
|
||||
),
|
||||
activitySummary = activitySummary,
|
||||
seriesList = seriesList,
|
||||
isBlock = isBlock
|
||||
isBlock = isBlock,
|
||||
isCreator = isCreator
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ data class GetCreatorProfileResponse(
|
|||
val cheers: GetCheersResponse,
|
||||
val activitySummary: GetCreatorActivitySummary,
|
||||
val seriesList: List<GetSeriesListResponse.SeriesListItem>,
|
||||
val isBlock: Boolean
|
||||
val isBlock: Boolean,
|
||||
val isCreator: Boolean
|
||||
)
|
||||
|
||||
data class GetCreatorActivitySummary(
|
||||
|
|
Loading…
Reference in New Issue