Repository navigation
[Fix] 휴지통 폴더 목록 materialCount가 항상 0으로 나오던 문제 수정 - #140
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough휴지통 폴더 목록이 Changes휴지통 자료 수 집계
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant TrashService
participant MaterialRepository
participant TrashFolderItemResponse
Client->>TrashService: 휴지통 폴더 목록 요청
TrashService->>MaterialRepository: 삭제 자료를 폴더별로 집계
MaterialRepository-->>TrashService: 폴더별 삭제 자료 수
TrashService->>TrashFolderItemResponse: folder와 materialCount 전달
TrashFolderItemResponse-->>Client: 휴지통 폴더 목록 응답
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/teaching/backend/domain/material/repository/MaterialRepository.java (1)
290-305: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift네이티브 집계 쿼리를 저장소 통합 테스트로 검증하세요.
현재 추가된
TrashServiceTest는MaterialRepository를 mock하므로 Line 293-298의folder_id,user_id,deleted_at,GROUP BY조건과folderId및materialCountprojection 매핑을 검증하지 않습니다. 기존src/test/java/com/teaching/backend/domain/material/repository/MaterialRepositoryTest.java에 실제 데이터베이스를 사용하는 테스트가 없다면, 여러 사용자와 폴더의 활성·삭제 자료를 포함한 시나리오를 추가하고 폴더별 집계 결과를 확인하세요.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/teaching/backend/domain/material/repository/MaterialRepository.java` around lines 290 - 305, Add an integration test in MaterialRepositoryTest for countDeletedByFolderIdsAndUserId using a real database, seeding multiple users and folders with both active and deleted materials. Verify only the requested user’s deleted materials are counted per folder, and assert the FolderMaterialRestoreCountProjection folderId and materialCount mappings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/main/java/com/teaching/backend/domain/material/repository/MaterialRepository.java`:
- Around line 290-305: Add an integration test in MaterialRepositoryTest for
countDeletedByFolderIdsAndUserId using a real database, seeding multiple users
and folders with both active and deleted materials. Verify only the requested
user’s deleted materials are counted per folder, and assert the
FolderMaterialRestoreCountProjection folderId and materialCount mappings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b5769f7f-44ae-40cd-b1bd-c183a45834d7
📒 Files selected for processing (5)
src/main/java/com/teaching/backend/domain/folder/entity/Folder.javasrc/main/java/com/teaching/backend/domain/material/repository/MaterialRepository.javasrc/main/java/com/teaching/backend/domain/trash/dto/response/TrashFolderItemResponse.javasrc/main/java/com/teaching/backend/domain/trash/service/TrashService.javasrc/test/java/com/teaching/backend/domain/trash/service/TrashServiceTest.java
|
@coderabbitai rate limit |
|
Your plan includes PR reviews subject to rate limits. More reviews will be available in 50 minutes. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
✨ 어떤 이유로 PR를 하셨나요?
📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요
휴지통 폴더 목록 API(
GET /api/v1/trash/folders)에서materialCount가 항상 0으로 조회되던 문제를 수정했습니다.변경 사항
MaterialRepository에countDeletedByFolderIdsAndUserId추가 — 폴더 ID 목록별로 삭제된 자료 개수를 batch COUNTTrashService.getTrashedFolders()가 이 쿼리로 실시간 개수를 계산해TrashFolderItemResponse에 전달하도록 변경 (기존Folder.itemCount참조 제거)Folder.itemCount필드 자체는 DB 컬럼이NOT NULL이고 기본값이 없어 제거 시 폴더 생성이 깨지므로 유지하되, "읽지 말 것" 주석 추가TrashServiceTest에 회귀 테스트 3건 추가📸 작업 화면 스크린샷
🚨 관련 이슈 번호 [ ]
Summary by CodeRabbit
0으로 표시됩니다.