-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'KakaoFunding:develop' into develop
- Loading branch information
Showing
9 changed files
with
93 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
.../java/org/kakaoshare/backend/domain/funding/dto/rank/response/TopContributorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.kakaoshare.backend.domain.funding.dto.rank.response; | ||
|
||
public record TopContributorResponse( | ||
String profileUrl, | ||
String name, | ||
Double rate | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
INSERT INTO payment (created_at, delivery_price, payment_id, purchase_price, total_price, payment_number, method) | ||
VALUES (NOW(), 0, 1, 3000, 3000, '1', 'KAKAO_PAY'), | ||
(NOW(), 0, 2, 2000, 2000, '2', 'KAKAO_PAY'), | ||
(NOW(), 0, 3, 1000, 1000, '3', 'KAKAO_PAY'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
INSERT INTO funding_detail (created_at, amount, rate, funding_id, payment_id, member_id, status) | ||
VALUES (NOW(), 3000, 30.0, 1, 1, 1, 'PROGRESS'), | ||
(NOW(), 2000, 20.0, 1, 1, 2, 'PROGRESS'), | ||
(NOW(), 1000, 10.0, 1, 1, 3, 'PROGRESS'); |
32 changes: 32 additions & 0 deletions
32
...st/java/org/kakaoshare/backend/domain/funding/repository/FundingDetailRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.kakaoshare.backend.domain.funding.repository; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.kakaoshare.backend.common.RepositoryTest; | ||
import org.kakaoshare.backend.domain.funding.dto.rank.response.TopContributorResponse; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Sort; | ||
|
||
import java.util.List; | ||
|
||
@RepositoryTest | ||
class FundingDetailRepositoryTest { | ||
@Autowired | ||
FundingDetailRepository fundingDetailRepository; | ||
|
||
@Test | ||
@DisplayName("최대 기여자 조회") | ||
public void findTopContributorsByFundingId() throws Exception { | ||
final Long fundingId = 1L; | ||
final Pageable pageable = PageRequest.of(0, 5, Sort.by(Sort.Direction.DESC, "rate")); | ||
final Page<TopContributorResponse> page = fundingDetailRepository.findTopContributorsByFundingId(fundingId, pageable); | ||
final List<TopContributorResponse> content = page.getContent(); | ||
Assertions.assertThat(content.get(0).rate()).isEqualTo(30.0); | ||
Assertions.assertThat(content.get(1).rate()).isEqualTo(20.0); | ||
Assertions.assertThat(content.get(2).rate()).isEqualTo(10.0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters