-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/mosu 374 관리자 대시보드 신청 수 수정, 수험표 및 관리자 신청 조회 부분 user -> profile 로 변경 #375
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughAdds virtual account deposit counting to the admin dashboard and constrains payment counts by a start date. Adjusts exam ticket/user data sources from User to Profile in queries and mappings. Introduces a new repository method to count virtual account deposits by status and adds conditional lunch-name exposure. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Admin as Admin
participant API as Admin API
participant Svc as AdminDashboardService
participant ExamRepo as ExamApplicationJpaRepository
participant VARepo as VirtualAccountLogJpaRepository
participant RefundRepo as RefundFailureLogJpaRepository
participant UserRepo as UserJpaRepository
Admin->>API: GET /admin/dashboard
API->>Svc: fetchDashboard()
Note over Svc: Compute counts
Svc->>ExamRepo: countAllSince(startDate)
ExamRepo-->>Svc: long paymentCount
Svc->>VARepo: countByDepositStatus(DONE)
VARepo-->>Svc: long vaDoneCount
Svc->>RefundRepo: countByStatus(ABORTED?) / existing logic
RefundRepo-->>Svc: long refundAbortedCounts
Svc->>UserRepo: countAll() / existing logic
UserRepo-->>Svc: long userCounts
Note over Svc: applicationCounts = paymentCount + vaDoneCount
Svc-->>API: DashBoardResponse(applicationCounts, refundAbortedCounts, userCounts)
API-->>Admin: 200 OK + response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Summary of Changes
Hello @chominju02, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
이 PR은 관리자 대시보드의 신청 수 집계 로직을 개선하고, 수험표 및 관리자 신청 조회 기능에서 사용자 관련 데이터를 User 엔티티가 아닌 Profile 엔티티를 통해 조회하도록 리팩토링합니다. 이를 통해 대시보드 데이터의 정확성을 높이고, 사용자 프로필 정보 관리의 일관성을 강화합니다.
Highlights
- 관리자 대시보드 신청 수 개선: 관리자 대시보드의 신청 수 집계에 가상계좌를 통한 신청 건수가 포함되도록 로직이 수정되었습니다.
- 사용자 정보 조회 소스 변경: 수험표 및 관리자 신청 조회 시, 사용자 관련 정보를
User엔티티 대신Profile엔티티를 통해 조회하도록 변경하여 데이터 일관성을 높였습니다.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
이 PR은 관리자 대시보드의 신청 수 집계 로직을 수정하고, 수험표 및 신청 조회에서 사용자 정보를 user 엔티티 대신 profile 엔티티에서 가져오도록 리팩터링했습니다. 가상계좌 결제 건수를 포함하도록 대시보드 로직이 개선되었고, 관련 쿼리들이 profile을 사용하도록 일관성 있게 수정되었습니다. 전반적으로 코드 변경 사항은 명확하며 PR의 목적을 잘 달성하고 있습니다. 한 가지, 하드코딩된 날짜 값을 상수로 추출하여 코드의 가독성과 유지보수성을 높이는 것을 제안합니다.
| public DashBoardResponse getAll() { | ||
|
|
||
| Long applicationCounts = examApplicationJpaRepository.countAll(); | ||
| LocalDate startDate = LocalDate.of(2025, 8, 20); |
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.
하드코딩된 날짜 LocalDate.of(2025, 8, 20)가 사용되었습니다. 이러한 '매직 값'은 코드의 의도를 파악하기 어렵게 만들고, 향후 날짜 변경이 필요할 때 여러 곳을 수정해야 하는 등 유지보수를 어렵게 할 수 있습니다. 이 값을 의도를 명확히 나타내는 이름의 상수로 추출하는 것이 좋습니다. 예를 들어, 클래스 상단에 private static final LocalDate APPLICATION_COUNT_START_DATE = LocalDate.of(2025, 8, 20);와 같이 상수를 선언하고 이를 참조하도록 변경하는 것을 권장합니다.
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/java/life/mosu/mosuserver/domain/examapplication/repository/ExamApplicationJpaRepository.java (1)
214-216: Refactor countAllSince to align types
InExamApplicationJpaRepository.java(methodcountAllSince),p.createdAtis aLocalDateTime(inherited fromBaseTimeEntity), but the parameter:startDateis aLocalDate. Comparing those directly can yield incorrect results. Either:
- Change the signature to accept a
LocalDateTime(e.g.@Param("startDateTime") LocalDateTime startDateTime) and callp.createdAt >= :startDateTime(passingstartDate.atStartOfDay()),- Or use a JPQL function to truncate the timestamp:
AND FUNCTION('DATE', p.createdAt) >= :startDate.
This will ensure the comparison behaves as intended.src/main/java/life/mosu/mosuserver/application/admin/AdminDashboardService.java (1)
26-26: Consider making the start date configurable.The hardcoded start date
LocalDate.of(2025, 8, 20)may need to be updated in the future. Consider making this configurable through application properties or as a parameter.- LocalDate startDate = LocalDate.of(2025, 8, 20); + LocalDate startDate = LocalDate.of(2025, 8, 20); // TODO: Make configurable via application.propertiesAlternatively, you could extract this to a configuration class or make it an environment variable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
src/main/java/life/mosu/mosuserver/application/admin/AdminDashboardService.java(2 hunks)src/main/java/life/mosu/mosuserver/domain/examapplication/repository/ExamApplicationJpaRepository.java(4 hunks)src/main/java/life/mosu/mosuserver/domain/virtualaccount/VirtualAccountLogJpaRepository.java(1 hunks)src/main/java/life/mosu/mosuserver/infra/persistence/jpa/ApplicationQueryRepositoryImpl.java(5 hunks)
🔇 Additional comments (10)
src/main/java/life/mosu/mosuserver/domain/virtualaccount/VirtualAccountLogJpaRepository.java (1)
11-11: LGTM! Clean repository method addition.The new
countByDepositStatusmethod follows Spring Data JPA naming conventions and provides a straightforward way to count virtual account deposits by status.src/main/java/life/mosu/mosuserver/infra/persistence/jpa/ApplicationQueryRepositoryImpl.java (4)
102-104: User to Profile migration looks good.The SELECT clause correctly references profile fields instead of user fields, aligning with the PR objective.
135-135: Name search predicate updated correctly.The name search condition now properly uses
profile.userNameinstead ofuser.name.
177-177: Good implementation of conditional lunch name exposure.The lunch name is now conditionally exposed based on the
isLunchCheckedflag, which is a good privacy practice. The implementation usingBoolean.TRUE.equals()properly handles null values.Also applies to: 190-191
212-212: Consistent conditional logic in Excel export.The Excel export method maintains the same conditional lunch name logic as the response mapping, ensuring consistency across different output formats.
Also applies to: 229-229
src/main/java/life/mosu/mosuserver/domain/examapplication/repository/ExamApplicationJpaRepository.java (2)
4-4: Import added for date filtering.The LocalDate import is properly added to support the new date-based filtering functionality.
59-60: Exam ticket query correctly migrated to Profile.The query now properly joins with ProfileJpaEntity and retrieves
userNameandbirthfrom the profile table instead of the user table, maintaining consistency with the overall migration strategy.Also applies to: 70-70
src/main/java/life/mosu/mosuserver/application/admin/AdminDashboardService.java (3)
3-3: LGTM! Clean imports added for new functionality.The new imports
LocalDate,DepositStatus, andVirtualAccountLogJpaRepositoryare properly organized and necessary for the enhanced dashboard logic.Also applies to: 8-9
19-19: LGTM! Repository dependency correctly injected.The
VirtualAccountLogJpaRepositoryis properly added as a final field for dependency injection.
27-32: LGTM! Application count logic correctly implements the requirements.The implementation properly:
- Counts exam applications since the start date
- Counts completed virtual account deposits
- Sums both counts for the total application count
This aligns with the PR objective to include virtual account applications in the dashboard count.
|
|
||
| Long applicationCounts = examApplicationJpaRepository.countAll(); | ||
| LocalDate startDate = LocalDate.of(2025, 8, 20); | ||
| Long paymentCounts = examApplicationJpaRepository.countAllSince(startDate); |
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.
💡 Verification agent
🧩 Analysis chain
Verify the repository methods exist and handle edge cases.
Please ensure that:
- The
countAllSince(LocalDate)method exists inExamApplicationJpaRepository - The
countByDepositStatus(DepositStatus)method exists inVirtualAccountLogJpaRepository - Both methods handle null inputs gracefully
Also applies to: 29-30
🏁 Script executed:
#!/bin/bash
# Description: Verify the repository methods exist and check their implementations
# Search for countAllSince method in ExamApplicationJpaRepository
echo "=== Checking ExamApplicationJpaRepository.countAllSince method ==="
rg -n "countAllSince" --type=java
# Search for countByDepositStatus method in VirtualAccountLogJpaRepository
echo -e "\n=== Checking VirtualAccountLogJpaRepository.countByDepositStatus method ==="
rg -n "countByDepositStatus" --type=java
# Check DepositStatus enum values
echo -e "\n=== Checking DepositStatus enum ==="
rg -n "enum DepositStatus|DONE" --type=java -A 5 -B 2Length of output: 36166
Add null check for startDate
In AdminDashboardService.getDashboardData(), insert
Objects.requireNonNull(startDate, "startDate must not be null");before calling
examApplicationJpaRepository.countAllSince(startDate);Methods exist as expected.
🤖 Prompt for AI Agents
In
src/main/java/life/mosu/mosuserver/application/admin/AdminDashboardService.java
around line 27, the call to
examApplicationJpaRepository.countAllSince(startDate) lacks a null check for
startDate; insert a null check using Objects.requireNonNull(startDate,
"startDate must not be null") immediately before that call, and add an import
for java.util.Objects if it isn't already present.
✨ 구현한 기능
📢 논의하고 싶은 내용
🎸 기타
Summary by CodeRabbit