Skip to content

Dev#300

Merged
Misu0616 merged 2 commits into
mainfrom
dev
Mar 19, 2026
Merged

Dev#300
Misu0616 merged 2 commits into
mainfrom
dev

Conversation

@pjh813
Copy link
Copy Markdown
Contributor

@pjh813 pjh813 commented Mar 19, 2026

개요

관련 BackLog

Resolves: (Backlog Number, ...)

PR 유형

  • 새로운 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 테스트 추가, 테스트 리팩토링
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

PR Checklist

  • 커밋 메시지 컨벤션에 맞게 작성했습니다.
  • 변경 사항에 대한 테스트를 했습니다.(버그 수정/기능에 대한 테스트).

Summary by CodeRabbit

  • New Features

    • Data usage API responses now include a shared pool remaining amount field. This shows users how much data is available in their family shared pools for the current billing period.
  • Bug Fixes

    • Corrected shared pool remaining calculations to use monthly usage data aggregation, replacing previous methodology for improved accuracy.

@pjh813 pjh813 requested a review from Misu0616 March 19, 2026 17:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1517ab35-27df-467a-b921-4a7db2999c0d

📥 Commits

Reviewing files that changed from the base of the PR and between d95d795 and c39f149.

📒 Files selected for processing (7)
  • src/main/java/com/pooli/data/domain/dto/response/DataUsageResDto.java
  • src/main/java/com/pooli/data/service/impl/DataServiceImpl.java
  • src/main/java/com/pooli/family/service/FamilySharedPoolsService.java
  • src/main/java/com/pooli/family/service/impl/FamilyServiceImpl.java
  • src/test/java/com/pooli/data/service/impl/DataServiceImplTest.java
  • src/test/java/com/pooli/family/service/FamilySharedPoolsServiceTest.java
  • src/test/java/com/pooli/family/service/impl/FamilyServiceImplTest.java

📝 Walkthrough

Walkthrough

This PR introduces a new sharedPoolRemainingAmount response field to DataUsageResDto and refactors family shared-pool remaining calculations to use month-aggregated logic. FamilySharedPoolsService gains four new public APIs for computing monthly shared pool remaining, usage, and per-member display values. DataServiceImpl and FamilyServiceImpl are updated to call these new APIs for current-month responses, with DataServiceImpl also newly depending on FamilySharedPoolsService. Tests are updated to verify the new field and monthly calculation semantics.

Changes

Cohort / File(s) Summary
Response DTO
src/main/java/com/pooli/data/domain/dto/response/DataUsageResDto.java
Added sharedPoolRemainingAmount field (nullable Long) with Swagger annotation to document the new shared data remaining metric.
Data Service Logic
src/main/java/com/pooli/data/service/impl/DataServiceImpl.java
Introduced FamilySharedPoolsService dependency and updated getDataUsage to compute sharedPoolRemainingAmount and sharedPoolUsedAmount via new nullable Long normalization methods and family monthly remaining/usage calculations (current-month only).
Family Shared Pools Service
src/main/java/com/pooli/family/service/FamilySharedPoolsService.java
Added four new public APIs: resolveFamilyMonthlySharedPoolRemaining, resolveFamilyMemberMonthlySharedPoolDisplay, resolveSharedPoolRemainingAmount, and calculateFamilyMonthlySharedUsed. Updated getSharedPoolMain to use month-aggregated remaining instead of actual remaining. Introduced private helpers for adjusted monthly usage loading, safe summation, and remaining calculation.
Family Service Implementation
src/main/java/com/pooli/family/service/impl/FamilyServiceImpl.java
Added FamilySharedPoolsService dependency and updated shared pool remaining resolution to use monthly aggregated values via resolveFamilyMonthlySharedPoolRemaining and resolveSharedPoolRemainingAmount, with policy-aware handling for unlimited (-1L) limits.
Data Service Tests
src/test/java/com/pooli/data/service/impl/DataServiceImplTest.java
Extended mocks for FamilySharedPoolsService. Updated existing test assertions to verify sharedPoolRemainingAmount field. Added test for unlimited shared limit preservation (-1L). Updated non-current-month test to verify null remaining.
Family Shared Pools Service Tests
src/test/java/com/pooli/family/service/FamilySharedPoolsServiceTest.java
Updated getSharedPoolMain_success mock setup to use family monthly usage mapper and adjusted expected remaining value from 1_350_000L to 1_150_000L to reflect month-based calculation.
Family Service Tests
src/test/java/com/pooli/family/service/impl/FamilyServiceImplTest.java
Added FamilySharedPoolsService mock. Updated getFamilyMembers test stubbing to use monthly remaining resolution. Added test case for shared-limit-active behavior verifying per-member remaining computation.

Sequence Diagram

sequenceDiagram
    participant DataServiceImpl
    participant FamilySharedPoolsService
    participant FamilyMembersResDto
    participant DataUsageResDto

    DataServiceImpl->>FamilySharedPoolsService: resolveFamilyMemberMonthlySharedPoolDisplay(lineId)
    FamilySharedPoolsService-->>DataServiceImpl: FamilyMemberDto with totalAmount & remainingAmount
    
    DataServiceImpl->>FamilySharedPoolsService: resolveFamilyMonthlySharedPoolRemaining(familyId)
    FamilySharedPoolsService-->>DataServiceImpl: Long familyMonthlyRemaining

    DataServiceImpl->>DataServiceImpl: Normalize & compute sharedPoolRemainingAmount
    DataServiceImpl->>DataServiceImpl: Calculate sharedPoolUsedAmount = total - remaining
    
    DataServiceImpl->>DataUsageResDto: Create with personalTotal, sharedPoolTotal, sharedPoolRemaining
    DataUsageResDto-->>DataServiceImpl: DataUsageResDto payload
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

  • Dev #226: Modifies family/shared-pool domain with related changes to FamilySharedPoolsService, mappers, and shared-pool remaining/usage field propagation.
  • Dev #289: Updates FamilySharedPoolsService's monthly shared-pool usage and remaining logic including per-line monthly usage handling.
  • Dev #233: Changes how family shared-pool remaining is computed via month-aggregated monthly_shared_usage, directly aligned with this PR's new calculation semantics.

Suggested labels

feature

Suggested reviewers

  • Misu0616
  • Iwantcod

Poem

🐰 A pool of data, shared by kin,
Now monthly sums let insights in.
The rabbit hops through lanes so bright,
Computing remaining, oh what delight!
Per-member views and balances true,
A fresher way to see what's due. 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Misu0616 Misu0616 merged commit 1b17ef1 into main Mar 19, 2026
2 of 3 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 23, 2026
Merged
13 tasks
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