From 3cabc9de95791181c8409655414499a92ec81f29 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 3 Feb 2026 16:05:26 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9B=84=EC=9B=90=EB=9E=AD=ED=82=B9=20?= =?UTF-8?q?=EA=B8=B0=EA=B0=84=20=EC=84=A0=ED=83=9D=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 크리에이터 본인 조회 시 후원랭킹 기간을 선택하도록 period 파라미터를 제공한다. --- .../sodalive/explorer/ExplorerController.kt | 4 +++- .../vividnext/sodalive/explorer/ExplorerService.kt | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt index 21a4c8e1..46fdeae2 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerController.kt @@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.explorer.profile.PostWriteCheersRequest import kr.co.vividnext.sodalive.explorer.profile.PutWriteCheersRequest import kr.co.vividnext.sodalive.i18n.LangContext import kr.co.vividnext.sodalive.i18n.SodaMessageSource +import kr.co.vividnext.sodalive.member.DonationRankingPeriod import kr.co.vividnext.sodalive.member.Member import org.springframework.data.domain.Pageable import org.springframework.security.access.prepost.PreAuthorize @@ -75,11 +76,12 @@ class ExplorerController( @GetMapping("/profile/{id}/donation-rank") fun getCreatorProfileDonationRanking( @PathVariable("id") creatorId: Long, + @RequestParam("period", required = false) period: DonationRankingPeriod? = null, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, pageable: Pageable ) = run { if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") - ApiResponse.ok(service.getCreatorProfileDonationRanking(creatorId, pageable, member)) + ApiResponse.ok(service.getCreatorProfileDonationRanking(creatorId, period, pageable, member)) } @PostMapping("/profile/cheers") 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 6d0a4b62..69a8d013 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt @@ -399,26 +399,33 @@ class ExplorerService( fun getCreatorProfileDonationRanking( creatorId: Long, + period: DonationRankingPeriod?, pageable: Pageable, member: Member ): GetDonationAllResponse { val creatorAccount = queryRepository.getMember(creatorId) ?: throw SodaException(messageKey = "member.validation.user_not_found") val donationRankingPeriod = creatorAccount.donationRankingPeriod ?: DonationRankingPeriod.CUMULATIVE + val isCreatorSelf = creatorId == member.id!! + val effectivePeriod = if (isCreatorSelf && period != null) { + period + } else { + donationRankingPeriod + } val currentDate = LocalDate.now().atTime(0, 0, 0) val firstDayOfLastWeek = currentDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).minusDays(7) val firstDayOfMonth = currentDate.with(TemporalAdjusters.firstDayOfMonth()) val donationMemberTotal = donationRankingService.getMemberDonationRankingTotal( creatorId, - donationRankingPeriod + effectivePeriod ) val donationRanking = donationRankingService.getMemberDonationRanking( creatorId = creatorId, offset = pageable.offset, limit = pageable.pageSize.toLong(), - withDonationCan = creatorId == member.id!!, - period = donationRankingPeriod + withDonationCan = isCreatorSelf, + period = effectivePeriod ) return GetDonationAllResponse(