From eb36313c9b057b2eab77a2d591cbbe30b1a75be0 Mon Sep 17 00:00:00 2001 From: Klaus Date: Sat, 4 Jan 2025 00:43:10 +0900 Subject: [PATCH] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=20=ED=94=84=EB=A1=9C=ED=95=84=20API=20-=20=EB=9E=AD=ED=82=B9,?= =?UTF-8?q?=20=EC=B6=94=EC=B2=9C=20=ED=81=AC=EB=A6=AC,=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C,=20=EC=BD=98=ED=85=90=EC=B8=A0,=20=EC=8B=9C?= =?UTF-8?q?=EB=A6=AC=EC=A6=88,=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0,=20?= =?UTF-8?q?=ED=99=9C=EB=8F=99=EC=9A=94=EC=95=BD=EC=9D=84=20=ED=81=AC?= =?UTF-8?q?=EB=A6=AC=EC=97=90=EC=9D=B4=ED=84=B0=EC=9D=B8=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=EC=97=90=EB=A7=8C=20=EC=A1=B0=ED=9A=8C=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/explorer/ExplorerService.kt | 112 ++++++++++++------ .../explorer/GetCreatorProfileResponse.kt | 3 +- 2 files changed, 75 insertions(+), 40 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt index 5286adf..a7c3a0e 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt @@ -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,37 +164,57 @@ class ExplorerService( } // 추천 크리에이터 - val similarCreatorList = queryRepository.getSimilarCreatorList(creatorId) + val similarCreatorList = if (isCreator) { + queryRepository.getSimilarCreatorList(creatorId) + } else { + listOf() + } // 라이브 - val liveRoomList = queryRepository.getLiveRoomList( - creatorId, - userMember = member, - timezone = timezone, - limit = 3 - ) + val liveRoomList = if (isCreator) { + queryRepository.getLiveRoomList( + creatorId, + userMember = member, + timezone = timezone, + limit = 3 + ) + } else { + listOf() + } // 오디오 콘텐츠 - val contentList = audioContentService.getAudioContentList( - creatorId = creatorId, - sortType = SortType.NEWEST, - member = member, - offset = 0, - limit = 3 - ).items + 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( - creatorId = creatorId, - memberId = member.id!!, - timezone = timezone, - offset = 0, - limit = 3, - isAdult = member.auth != null - ) + val communityPostList = if (isCreator) { + communityService.getCommunityPostList( + creatorId = creatorId, + memberId = member.id!!, + timezone = timezone, + offset = 0, + 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 liveCount = queryRepository.getLiveCount(creatorId) ?: 0 - val liveTime = queryRepository.getLiveTime(creatorId) - val liveContributorCount = queryRepository.getLiveContributorCount(creatorId) ?: 0 - val contentCount = queryRepository.getContentCount(creatorId) ?: 0 + 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 - .getSeriesList(creatorId = creatorId, member = member) - .items + 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 ) } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/GetCreatorProfileResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/GetCreatorProfileResponse.kt index bfdd016..5ff9ed5 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/GetCreatorProfileResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/GetCreatorProfileResponse.kt @@ -15,7 +15,8 @@ data class GetCreatorProfileResponse( val cheers: GetCheersResponse, val activitySummary: GetCreatorActivitySummary, val seriesList: List, - val isBlock: Boolean + val isBlock: Boolean, + val isCreator: Boolean ) data class GetCreatorActivitySummary(