[FEATURE] 강사 마이페이지 본인 정보 + 통계 및 외주 내역 조회#50
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough강사 마이페이지 기능을 위한 두 개의 API를 추가한다. Changes강사 마이페이지 API 구현
Sequence Diagram(s)sequenceDiagram
participant Client
participant InstructorController
participant InstructorFacade
participant InstructorService
participant PaymentService
participant InstructorCommissionService
participant InstructorResponseMapper
Client->>InstructorController: GET /api/v1/instructors/me
InstructorController->>InstructorFacade: getMyStats(instructorId)
InstructorFacade->>InstructorService: getByIdWithUser(instructorId)
InstructorService-->>InstructorFacade: Instructor with User
InstructorFacade->>PaymentService: countPaidCommissions(instructorId)
PaymentService-->>InstructorFacade: totalCommissionCount
InstructorFacade->>InstructorCommissionService: countOngoingCommissions(instructorId)
InstructorCommissionService-->>InstructorFacade: ongoingCommissionCount
InstructorFacade->>InstructorResponseMapper: toInstructorStatsResponse(name, profileImageKey, total, ongoing)
InstructorResponseMapper-->>InstructorFacade: InstructorStatsResponse
InstructorFacade-->>InstructorController: InstructorStatsResponse
InstructorController-->>Client: ApiResponse~InstructorStatsResponse~
sequenceDiagram
participant Client
participant InstructorCommissionHistoryController
participant InstructorCommissionHistoryFacade
participant CommissionHistoryService
participant CommissionHistoryRepository
participant PaymentService
participant PaymentRepository
Client->>InstructorCommissionHistoryController: GET /api/v1/instructors/commissions?page&size
InstructorCommissionHistoryController->>InstructorCommissionHistoryFacade: getInstructorCommissions(instructorId, pageable)
InstructorCommissionHistoryFacade->>CommissionHistoryService: getInstructorCommissions(instructorId, pageable)
CommissionHistoryService->>CommissionHistoryRepository: findByInstructorId(instructorId, pageable)
CommissionHistoryRepository-->>CommissionHistoryService: Page~Commission~
CommissionHistoryService-->>InstructorCommissionHistoryFacade: Page~Commission~
InstructorCommissionHistoryFacade->>PaymentService: getPaidAmounts(commissionIds)
PaymentService->>PaymentRepository: findPaidAmounts(commissionIds, COMPLETED)
PaymentRepository-->>PaymentService: List~CommissionPaidAmount~
PaymentService-->>InstructorCommissionHistoryFacade: Map~Long,Integer~
InstructorCommissionHistoryFacade-->>InstructorCommissionHistoryController: InstructorCommissionHistoryResponse
InstructorCommissionHistoryController-->>Client: ApiResponse~InstructorCommissionHistoryResponse~
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java (1)
18-19: 🧹 Nitpick | 🔵 Trivialmutable Set을 그대로 반환하므로 불변 뷰로 변경하세요.
라인 18-19에서
EnumSet레퍼런스를 직접 반환하고 있습니다. 현재 호출부에서는 읽기만 하고 있지만, 공개 메서드로 반환하는 것은 defensive programming 관점에서 위험합니다. 외부에서add(),remove()등으로 집합을 변경할 수 있으므로,Collections.unmodifiableSet()으로 불변 뷰를 반환해야 합니다.변경 제안
import java.util.EnumSet; +import java.util.Collections; import java.util.Set; @@ public static Set<CommissionStatus> ongoingStatuses() { - return ONGOING; + return Collections.unmodifiableSet(ONGOING); }🤖 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/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java` around lines 18 - 19, The ongoingStatuses() method currently returns the ONGOING EnumSet directly, which creates a risk of external code modifying the internal collection through methods like add() or remove(). Wrap the ONGOING reference with Collections.unmodifiableSet() in the return statement of the ongoingStatuses() method to provide an immutable view of the set while protecting the internal state.
🤖 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/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java`:
- Around line 18-19: The ongoingStatuses() method currently returns the ONGOING
EnumSet directly, which creates a risk of external code modifying the internal
collection through methods like add() or remove(). Wrap the ONGOING reference
with Collections.unmodifiableSet() in the return statement of the
ongoingStatuses() method to provide an immutable view of the set while
protecting the internal state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro Plus
Run ID: 46431d4a-52d1-4254-9ca5-e528612a3751
📒 Files selected for processing (15)
src/main/java/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.javasrc/main/java/ditda/backend/domain/commission/core/repository/CommissionRepository.javasrc/main/java/ditda/backend/domain/commission/core/service/InstructorCommissionService.javasrc/main/java/ditda/backend/domain/commission/history/controller/InstructorCommissionHistoryController.javasrc/main/java/ditda/backend/domain/commission/history/dto/response/InstructorCommissionHistoryResponse.javasrc/main/java/ditda/backend/domain/commission/history/facade/InstructorCommissionHistoryFacade.javasrc/main/java/ditda/backend/domain/commission/history/repository/CommissionHistoryRepository.javasrc/main/java/ditda/backend/domain/commission/history/service/CommissionHistoryService.javasrc/main/java/ditda/backend/domain/instructor/controller/InstructorController.javasrc/main/java/ditda/backend/domain/instructor/dto/response/InstructorStatsResponse.javasrc/main/java/ditda/backend/domain/instructor/facade/InstructorFacade.javasrc/main/java/ditda/backend/domain/instructor/mapper/InstructorResponseMapper.javasrc/main/java/ditda/backend/domain/payment/repository/PaymentRepository.javasrc/main/java/ditda/backend/domain/payment/repository/projection/CommissionPaidAmount.javasrc/main/java/ditda/backend/domain/payment/service/PaymentService.java
fervovita
left a comment
There was a problem hiding this comment.
수고하셨어요!!!
아래 코멘트 확인 부탁드립니다😄
🚀 Related issue
Closes #39
#️⃣ Summary
🔧 Changes
강사 마이페이지 (본인정보+통계) 조회 API 추가 [GET] /api/v1/instructors/me
강사 마이페이지 외주 내역 조회 API 추가 [GET] /api/v1/instructors/commissions
📸 Test Evidence
💬 Reviewer Notes
Summary by CodeRabbit
릴리스 노트