From ed4f0a62a193744db0a3afcd1cc91ebd93176f1c Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 5 Oct 2023 19:32:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B1=84=EB=84=90=20=ED=9B=84=EC=9B=90?= =?UTF-8?q?=EB=9E=AD=ED=82=B9=20=EB=B3=B4=EA=B8=B0=20=EC=8A=A4=EC=9C=84?= =?UTF-8?q?=EC=B9=AD=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/explorer/ExplorerQueryRepository.kt | 8 ++++++++ .../kr/co/vividnext/sodalive/explorer/ExplorerService.kt | 5 +++++ .../sodalive/explorer/MemberDonationRankingResponse.kt | 1 + src/main/kotlin/kr/co/vividnext/sodalive/member/Member.kt | 2 ++ .../kr/co/vividnext/sodalive/member/MemberService.kt | 4 ++++ .../co/vividnext/sodalive/member/ProfileUpdateRequest.kt | 1 + 6 files changed, 21 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt index 6af9d76..eaad92d 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt @@ -628,4 +628,12 @@ class ExplorerQueryRepository( ) .fetchFirst() } + + fun getVisibleDonationRank(creatorId: Long): Boolean { + return queryFactory + .select(member.isVisibleDonationRank) + .from(member) + .where(member.id.eq(creatorId)) + .fetchFirst() + } } 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 4738f03..84f3c33 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt @@ -290,6 +290,11 @@ class ExplorerService( } else { 0 }, + isVisibleDonationRank = if (creatorId == member.id!!) { + queryRepository.getVisibleDonationRank(creatorId) + } else { + false + }, totalCount = queryRepository.getMemberDonationRankingTotal(creatorId), userDonationRanking = queryRepository.getMemberDonationRanking( creatorId, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/MemberDonationRankingResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/MemberDonationRankingResponse.kt index 16af1c3..0776312 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/MemberDonationRankingResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/MemberDonationRankingResponse.kt @@ -4,6 +4,7 @@ data class GetDonationAllResponse( val accumulatedCansToday: Int, val accumulatedCansLastWeek: Int, val accumulatedCansThisMonth: Int, + val isVisibleDonationRank: Boolean, val totalCount: Int, val userDonationRanking: List ) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/member/Member.kt b/src/main/kotlin/kr/co/vividnext/sodalive/member/Member.kt index 8d8fbd1..1b5eb59 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/member/Member.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/member/Member.kt @@ -28,6 +28,8 @@ data class Member( @Enumerated(value = EnumType.STRING) var role: MemberRole = MemberRole.USER, + var isVisibleDonationRank: Boolean = true, + var isActive: Boolean = true, var container: String = "web" diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberService.kt index 9b788bc..975064f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/member/MemberService.kt @@ -547,6 +547,10 @@ class MemberService( member.blogUrl = profileUpdateRequest.blogUrl } + if (profileUpdateRequest.isVisibleDonationRank != null) { + member.isVisibleDonationRank = profileUpdateRequest.isVisibleDonationRank + } + return ProfileResponse(member, cloudFrontHost, profileUpdateRequest.container) } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/member/ProfileUpdateRequest.kt b/src/main/kotlin/kr/co/vividnext/sodalive/member/ProfileUpdateRequest.kt index 790db10..aeaac65 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/member/ProfileUpdateRequest.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/member/ProfileUpdateRequest.kt @@ -13,5 +13,6 @@ data class ProfileUpdateRequest( val instagramUrl: String? = null, val websiteUrl: String? = null, val blogUrl: String? = null, + val isVisibleDonationRank: Boolean? = null, val container: String )