-
Notifications
You must be signed in to change notification settings - Fork 35
[volume-10] Collect, Stack, Zip #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rnqhstmd
wants to merge
24
commits into
Loopers-dev-lab:rnqhstmd
Choose a base branch
from
rnqhstmd:round10
base: rnqhstmd
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
49c7279
setting: springdoc ์ค์ ์ถ
rnqhstmd 12a0760
feat: RankingPeriod enum ์ถ๊ฐ ๋ฐ command ์ ์ฉ
rnqhstmd c0005ac
feat: ๋ญํน ์กฐํ ๊ธฐ๋ฅ์ ๊ธฐ๊ฐ๋ณ ์ง์ ์ถ๊ฐ
rnqhstmd 15aece1
feat: RankingPageInfo์ RankingPeriod ์ถ๊ฐ ๋ฐ ๋ฉ์๋ ์์
rnqhstmd 4849e9e
feat: ์ฃผ๊ฐ ๋ฐ ์๊ฐ ๋ญํน ์กฐํ ๊ธฐ๋ฅ ์ถ๊ฐ
rnqhstmd d2c7ce7
feat: ๋ญํน ์กฐํ API์ ๊ธฐ๊ฐ๋ณ ์ง์ ์ถ๊ฐ
rnqhstmd 0ebf4be
feat: commerce-batch ๋ชจ๋ ์ถ๊ฐ
rnqhstmd 962d737
feat: ์ด๊ธฐ commerce-batch ์ ํ๋ฆฌ์ผ์ด์
์ค์ ๋ฐ ๋ฐฐ์น ์์
๊ตฌ์ฑ ์ถ๊ฐ
rnqhstmd 5884808
feat: ์๋ ๋ฐฐ์น ์ปจํธ๋กค๋ฌ ์ถ๊ฐ
rnqhstmd aaf8cd8
feat: MonthlyRanking ์ํฐํฐ ์ถ๊ฐ ๋ฐ ์๋ณ ๋ญํน ์ ์ฅ ๊ตฌ์กฐ ์ ์
rnqhstmd 904ef24
feat: MonthlyRanking ์ํฐํฐ ์ถ๊ฐ ๋ฐ ์๋ณ ๋ญํน ์ ๋ณด ์ ์
rnqhstmd 4563be8
feat: ์๋ณ/์ฃผ๊ฐ๋ณ job config ์ถ๊ฐ
rnqhstmd 170808d
feat: MonthlyRankingJpaRepository ๋ฐ WeeklyRankingJpaRepository์ ์ญ์ ๋ฉ์โฆ
rnqhstmd e27d520
feat: ์๋ณ/์ฃผ๊ฐ๋ณ ๋ญํน ํ๋ก์ธ์ ์ถ๊ฐ
rnqhstmd ebc3c17
feat: ์๊ฐ ๋ญํน ๋ฆฌ๋ ๋ฐ ์ฃผ๊ฐ ๋ญํน ๋ฆฌ๋ ์ถ๊ฐ
rnqhstmd b7c5d5f
feat: ์๊ฐ ๋ฐ ์ฃผ๊ฐ ๋ญํน ์์ฑ๊ธฐ ์ถ๊ฐ
rnqhstmd 897a2f0
feat: ์ ํ ๋ฉํธ๋ฆญ์ค ์ํฐํฐ ๋ฐ ๋ณตํฉ ํค ํด๋์ค ์ถ๊ฐ
rnqhstmd ff76dfb
feat: Redis์์ ๋ญํน ๊ฐ์ค์น๋ฅผ ์ฝ์ด์ค๋ ์ปดํฌ๋ํธ ์ถ๊ฐ
rnqhstmd 0d50304
feat: ์ ํ ๋ฉํธ๋ฆญ์ค ์์ฝ ๋ฐ ๋ญํฌ๋ ์ ํ ํด๋์ค ์ถ๊ฐ
rnqhstmd 52dbf4b
feat: ์ฃผ๊ฐ ๋ญํน ์ํฐํฐ ๋ฐ ์ธ๋ฑ์ค ์ถ๊ฐ
rnqhstmd ee7df8b
feat: YearMonthAttributeConverter ์ถ๊ฐ
rnqhstmd f74bed0
feat: RankingRepository ์ธํฐํ์ด์ค ์ถ๊ฐ
rnqhstmd 7d1d343
feat: MonthlyRankingJpaRepository์ @Transactional ์ด๋
ธํ
์ด์
์ถ๊ฐ
rnqhstmd 93b4a67
feat: ์ฃผ๊ฐ ๋ญํน ํ๋ก์ธ์์์ ๋ ์ง ๊ณ์ฐ ๋ก์ง ๊ฐ์ ๋ฐ ๋ฉํธ๋ฆญ์ค ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฉ์๋ ์์
rnqhstmd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 18 additions & 27 deletions
45
apps/commerce-api/src/main/java/com/loopers/application/ranking/RankingCommand.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,49 +1,40 @@ | ||
| package com.loopers.application.ranking; | ||
|
|
||
| import com.loopers.domain.ranking.RankingPeriod; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.time.format.DateTimeParseException; | ||
|
|
||
| public record RankingCommand( | ||
| LocalDate date, | ||
| RankingPeriod period, | ||
| int page, | ||
| int size | ||
| ) { | ||
| private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd"); | ||
| private static final int MAX_PAGE_SIZE = 100; | ||
| private static final int DEFAULT_PAGE_SIZE = 20; | ||
|
|
||
| public RankingCommand { | ||
| // ์ ํจ์ฑ ๊ฒ์ฆ | ||
| if (page < 0) { | ||
| page = 0; | ||
| } | ||
| if (size <= 0 || size > MAX_PAGE_SIZE) { | ||
| size = DEFAULT_PAGE_SIZE; | ||
| } | ||
| if (date == null) { | ||
| date = LocalDate.now(); | ||
| } | ||
| } | ||
| public static RankingCommand of(String date, String period, int page, int size) { | ||
| LocalDate parsedDate = (date == null || date.isBlank()) | ||
| ? LocalDate.now() | ||
| : LocalDate.parse(date, DATE_FORMATTER); | ||
|
|
||
| RankingPeriod rankingPeriod = parsePeriod(period); | ||
|
|
||
| public static RankingCommand of(String dateString, int page, int size) { | ||
| LocalDate date = parseDate(dateString); | ||
| return new RankingCommand(date, page, size); | ||
| return new RankingCommand(parsedDate, rankingPeriod, page, size); | ||
| } | ||
|
|
||
| public static RankingCommand today(int page, int size) { | ||
| return new RankingCommand(LocalDate.now(), page, size); | ||
| public static RankingCommand of(String date, int page, int size) { | ||
| return of(date, "daily", page, size); | ||
| } | ||
|
|
||
| private static LocalDate parseDate(String dateString) { | ||
| if (dateString == null || dateString.isBlank()) { | ||
| return LocalDate.now(); | ||
| private static RankingPeriod parsePeriod(String period) { | ||
| if (period == null || period.isBlank()) { | ||
| return RankingPeriod.DAILY; | ||
| } | ||
| try { | ||
| return LocalDate.parse(dateString, DATE_FORMATTER); | ||
| } catch (DateTimeParseException e) { | ||
| return LocalDate.now(); | ||
| return RankingPeriod.valueOf(period.toUpperCase()); | ||
| } catch (IllegalArgumentException e) { | ||
| return RankingPeriod.DAILY; | ||
| } | ||
| } | ||
| } | ||
|
|
This file contains hidden or 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
24 changes: 15 additions & 9 deletions
24
apps/commerce-api/src/main/java/com/loopers/application/ranking/RankingPageInfo.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,30 +1,36 @@ | ||
| package com.loopers.application.ranking; | ||
|
|
||
| import com.loopers.domain.ranking.RankingInfo; | ||
| import com.loopers.domain.ranking.RankingPeriod; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public record RankingPageInfo( | ||
| List<RankingInfo> rankings, | ||
| LocalDate date, | ||
| RankingPeriod period, | ||
| int page, | ||
| int size, | ||
| Long totalCount, | ||
| int totalPages | ||
| ) { | ||
| public static RankingPageInfo of( | ||
| List<RankingInfo> rankings, | ||
| LocalDate date, | ||
| int page, | ||
| int size, | ||
| Long totalCount | ||
| ) { | ||
| public static RankingPageInfo of(List<RankingInfo> rankings, LocalDate date, RankingPeriod period, | ||
| int page, int size, Long totalCount) { | ||
| int totalPages = (int) Math.ceil((double) totalCount / size); | ||
| return new RankingPageInfo(rankings, date, page, size, totalCount, totalPages); | ||
| return new RankingPageInfo(rankings, date, period, page, size, totalCount, totalPages); | ||
| } | ||
|
|
||
| public static RankingPageInfo empty(LocalDate date, RankingPeriod period, int page, int size) { | ||
| return new RankingPageInfo(List.of(), date, period, page, size, 0L, 0); | ||
| } | ||
|
|
||
| public static RankingPageInfo of(List<RankingInfo> rankings, LocalDate date, | ||
| int page, int size, Long totalCount) { | ||
| return of(rankings, date, RankingPeriod.DAILY, page, size, totalCount); | ||
| } | ||
|
|
||
| public static RankingPageInfo empty(LocalDate date, int page, int size) { | ||
| return new RankingPageInfo(List.of(), date, page, size, 0L, 0); | ||
| return empty(date, RankingPeriod.DAILY, page, size); | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
apps/commerce-api/src/main/java/com/loopers/domain/ranking/MonthlyRanking.java
This file contains hidden or 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,30 @@ | ||
| package com.loopers.domain.ranking; | ||
|
|
||
| import com.loopers.infrastructure.converter.YearMonthAttributeConverter; | ||
| import jakarta.persistence.*; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.YearMonth; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "mv_product_rank_monthly") | ||
| @NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) | ||
| public class MonthlyRanking { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "monthly_rank") | ||
| private int rank; | ||
|
|
||
| private Long productId; | ||
|
|
||
| private double score; | ||
|
|
||
| @Convert(converter = YearMonthAttributeConverter.class) | ||
| @Column(name = "month_period") | ||
| private YearMonth monthPeriod; | ||
| } | ||
7 changes: 7 additions & 0 deletions
7
apps/commerce-api/src/main/java/com/loopers/domain/ranking/RankingPeriod.java
This file contains hidden or 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,7 @@ | ||
| package com.loopers.domain.ranking; | ||
|
|
||
| public enum RankingPeriod { | ||
| DAILY, | ||
| WEEKLY, | ||
| MONTHLY | ||
| } |
23 changes: 23 additions & 0 deletions
23
apps/commerce-api/src/main/java/com/loopers/domain/ranking/RankingRepository.java
This file contains hidden or 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,23 @@ | ||
| package com.loopers.domain.ranking; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.time.YearMonth; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface RankingRepository { | ||
|
|
||
| // Weekly | ||
| List<WeeklyRanking> findWeeklyByDateOrderByRank(LocalDate weekStart, LocalDate weekEnd, int limit, int offset); | ||
|
|
||
| Optional<WeeklyRanking> findWeeklyByProductIdAndDate(Long productId, LocalDate weekStart, LocalDate weekEnd); | ||
|
|
||
| long countWeeklyByDate(LocalDate weekStart, LocalDate weekEnd); | ||
|
|
||
| // Monthly | ||
| List<MonthlyRanking> findMonthlyByPeriodOrderByRank(YearMonth period, int limit, int offset); | ||
|
|
||
| Optional<MonthlyRanking> findMonthlyByProductIdAndPeriod(Long productId, YearMonth period); | ||
|
|
||
| long countMonthlyByPeriod(YearMonth period); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ ๏ธ Refactor suggestion | ๐ Major
์ธ์คํด์ค ์์ฑ์ ์ํ ๋น๋ ๋๋ ํฉํ ๋ฆฌ ๋ฉ์๋ ์ถ๊ฐ๋ฅผ ๊ณ ๋ คํด์ฃผ์ธ์.
ํ์ฌ protected ๊ธฐ๋ณธ ์์ฑ์๋ง ์ ๊ณต๋์ด ์์ด, ๋ฐฐ์น ์์ ์์
MonthlyRanking์ธ์คํด์ค๋ฅผ ์์ฑํ๊ธฐ ์ด๋ ต์ต๋๋ค. ๊ณต๊ฐ ์์ฑ์, ๋น๋ ํจํด, ๋๋ ์ ์ ํฉํ ๋ฆฌ ๋ฉ์๋๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.๐ ๋น๋ ํจํด ์ถ๊ฐ ์ ์
๐ค Prompt for AI Agents