Skip to content

Conversation

@chominju02
Copy link
Contributor

@chominju02 chominju02 commented Sep 3, 2025

✨ 구현한 기능

  • 관리자 대시보드 신청 수에 가상계좌 신청 수 반영
  • 수험표, 관리자 신청 조회 부분 user -> profile 로 변경해야 할 부분 수정

📢 논의하고 싶은 내용

🎸 기타

Summary by CodeRabbit

  • New Features
    • Admin dashboard now includes completed virtual account deposits in application totals for more accurate metrics.
  • Bug Fixes
    • User name and birth details now sourced from profiles in tickets, lists, and exports, ensuring correct information is shown.
    • Name-based search uses profile name for more reliable results.
    • Lunch option name is displayed only when lunch is selected, preventing incorrect data from appearing in responses and exports.

@chominju02 chominju02 self-assigned this Sep 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
Admin dashboard aggregation
src/main/java/life/mosu/mosuserver/application/admin/AdminDashboardService.java
Dashboard now sums exam payments since a fixed start date with DONE virtual-account deposits. Injects VirtualAccountLogJpaRepository. Returns DashBoardResponse.of(...). Constructor updated via @RequiredArgsConstructor.
Exam application repository updates
src/main/java/life/mosu/mosuserver/domain/examapplication/repository/ExamApplicationJpaRepository.java
Replaces countAll() with countAllSince(LocalDate startDate) adding createdAt >= :startDate filter. Ticket projection now joins ProfileJpaEntity and uses pr.userName, pr.birth instead of u.name, u.birth.
Virtual account repository addition
src/main/java/life/mosu/mosuserver/domain/virtualaccount/VirtualAccountLogJpaRepository.java
Adds long countByDepositStatus(DepositStatus depositStatus) derived query.
Application query implementation adjustments
src/main/java/life/mosu/mosuserver/infra/persistence/jpa/ApplicationQueryRepositoryImpl.java
Switches fields from User to Profile: userName, gender, birth. Name search uses profile.userName.contains(...). Maps conditional lunch name based on isLunchChecked. Updates mappings for ticket/list/excel responses.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • wlgns12370
  • jbh010204
  • polyglot-k

Poem

A nibble of numbers, a hop through dates,
I tally deposits at dashboard gates.
Profiles whisper names, not Users today—
Lunch checked? Then menu hops into play.
With ears up high and counts so neat,
This bunny declares the metrics complete. 🐇📊

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/mosu-374

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

하드코딩된 날짜 LocalDate.of(2025, 8, 20)가 사용되었습니다. 이러한 '매직 값'은 코드의 의도를 파악하기 어렵게 만들고, 향후 날짜 변경이 필요할 때 여러 곳을 수정해야 하는 등 유지보수를 어렵게 할 수 있습니다. 이 값을 의도를 명확히 나타내는 이름의 상수로 추출하는 것이 좋습니다. 예를 들어, 클래스 상단에 private static final LocalDate APPLICATION_COUNT_START_DATE = LocalDate.of(2025, 8, 20);와 같이 상수를 선언하고 이를 참조하도록 변경하는 것을 권장합니다.

Copy link

@coderabbitai coderabbitai bot left a 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
In ExamApplicationJpaRepository.java (method countAllSince), p.createdAt is a LocalDateTime (inherited from BaseTimeEntity), but the parameter :startDate is a LocalDate. Comparing those directly can yield incorrect results. Either:

  • Change the signature to accept a LocalDateTime (e.g. @Param("startDateTime") LocalDateTime startDateTime) and call p.createdAt >= :startDateTime (passing startDate.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.properties

Alternatively, 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 59ba93d and 0f4e1af.

📒 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 countByDepositStatus method 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.userName instead of user.name.


177-177: Good implementation of conditional lunch name exposure.

The lunch name is now conditionally exposed based on the isLunchChecked flag, which is a good privacy practice. The implementation using Boolean.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 userName and birth from 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, and VirtualAccountLogJpaRepository are properly organized and necessary for the enhanced dashboard logic.

Also applies to: 8-9


19-19: LGTM! Repository dependency correctly injected.

The VirtualAccountLogJpaRepository is properly added as a final field for dependency injection.


27-32: LGTM! Application count logic correctly implements the requirements.

The implementation properly:

  1. Counts exam applications since the start date
  2. Counts completed virtual account deposits
  3. 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);
Copy link

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:

  1. The countAllSince(LocalDate) method exists in ExamApplicationJpaRepository
  2. The countByDepositStatus(DepositStatus) method exists in VirtualAccountLogJpaRepository
  3. 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 2

Length 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants