[WTH-82] 회비 조회시 최신순으로 정렬#232
Conversation
Walkthrough영수증 조회를 계정 엔티티 직접 접근에서 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Controller
participant AccountUseCaseImpl
participant ReceiptGetService
participant ReceiptRepository
Controller->>AccountUseCaseImpl: 요청: 계정 상세 조회 (accountId)
AccountUseCaseImpl->>ReceiptGetService: findAllByAccountId(accountId)
ReceiptGetService->>ReceiptRepository: findAllByAccountIdOrderByCreatedAtDesc(accountId)
ReceiptRepository-->>ReceiptGetService: List<Receipt> (생성일자 내림차순)
ReceiptGetService-->>AccountUseCaseImpl: List<Receipt>
AccountUseCaseImpl-->>Controller: 계정 상세 응답 (영수증 포함)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
시
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (2)
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. Comment |
seokjun01
left a comment
There was a problem hiding this comment.
고생하셨습니다 ~ 테스트 회비 데이터 3개가 다 12-01 날짜라 세부 순서는 잘 모르겠지만,
id로 보았을 때 3->2->1 순으로 최신순이라고 판단하면 되겠죠 !?
코드는 이상없어 보입니다~~
| import java.util.List; | ||
|
|
||
| public interface ReceiptRepository extends JpaRepository<Receipt, Long> { | ||
| List<Receipt> findAllByAccountIdOrderByIdDesc(Long accountId); |
There was a problem hiding this comment.
id도 괜찮긴 하지만, 직관성을 위해서 created_at을 기준으로 정렬하는건 어떨까요?
There was a problem hiding this comment.
넵 생성 시점이 중요하기에 정렬 기준을 id -> createdAt으로 변경했습니다
📌 PR 내용
🔍 PR 세부사항
📸 관련 스크린샷
{ "code": 200, "message": "회비가 성공적으로 조회되었습니다.", "data": { "accountId": 1, "description": "1기", "totalAmount": 10000, "currentAmount": 9400, "time": "2025-12-07T17:45:05.852681", "cardinal": 1, "receipts": [ { "id": 3, "description": "3번째", "source": "3번째입니다", "amount": 300, "date": "2025-12-01", "fileUrls": [ { "fileId": 4, "fileName": "파일이름", "fileUrl": "https://image.png" } ] }, { "id": 2, "description": "2번째", "source": "2번째입니다", "amount": 200, "date": "2025-12-01", "fileUrls": [ { "fileId": 3, "fileName": "파일이름", "fileUrl": "https://image.png" } ] }, { "id": 1, "description": "예시", "source": "예시입니다", "amount": 100, "date": "2025-12-01", "fileUrls": [ { "fileId": 2, "fileName": "파일이름", "fileUrl": "https://image.png" } ] } ] } }{ "code": 200, "message": "회비가 성공적으로 조회되었습니다.", "data": { "accountId": 2, "description": "2기", "totalAmount": 1000, "currentAmount": 1000, "time": "2025-12-07T17:56:38.663915", "cardinal": 2, "receipts": [] } }📝 주의사항
✅ 체크리스트
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.