Skip to content

[FEATURE] 강사 마이페이지 본인 정보 + 통계 및 외주 내역 조회#50

Merged
Jong0128 merged 11 commits into
devfrom
feat/#39-instructor-mypage
Jun 23, 2026
Merged

[FEATURE] 강사 마이페이지 본인 정보 + 통계 및 외주 내역 조회#50
Jong0128 merged 11 commits into
devfrom
feat/#39-instructor-mypage

Conversation

@Jong0128

@Jong0128 Jong0128 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

🚀 Related issue

Closes #39

#️⃣ Summary

  • 강사 마이페이지 정보 및 통계 조회 페이지 API 구현

🔧 Changes

  • 강사 마이페이지 (본인정보+통계) 조회 API 추가 [GET] /api/v1/instructors/me

  • 강사 마이페이지 외주 내역 조회 API 추가 [GET] /api/v1/instructors/commissions

📸 Test Evidence

스크린샷 2026-06-22 오후 8 46 07 스크린샷 2026-06-22 오후 8 47 29

💬 Reviewer Notes

  • 리뷰어나 같이 작업하는 사람들에게 남길 코멘트

Summary by CodeRabbit

릴리스 노트

  • New Features
    • 강사 마이페이지 통계: 이름, 프로필 이미지, 총 외주 건수, 진행 중 외주 건수 조회 기능 추가
    • 강사 외주 내역 조회: 페이지네이션을 지원하는 외주 이력 조회 API 제공(카테고리, 제목, 생성 일자, 요금제, 상태, 결제 금액 포함)
  • Configuration
    • 기본 페이지 크기(10) 및 최대 페이지 크기(30) 설정 추가, 페이지 파라미터 인덱싱 변경

@Jong0128 Jong0128 requested a review from fervovita as a code owner June 22, 2026 11:48
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: fe84644a-5166-4187-a4f3-4717a238b945

📥 Commits

Reviewing files that changed from the base of the PR and between 6307d7b and f50fec4.

📒 Files selected for processing (7)
  • src/main/java/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java
  • src/main/java/ditda/backend/domain/commission/history/controller/InstructorCommissionHistoryController.java
  • src/main/java/ditda/backend/domain/instructor/facade/InstructorFacade.java
  • src/main/java/ditda/backend/domain/instructor/mapper/InstructorResponseMapper.java
  • src/main/java/ditda/backend/domain/instructor/repository/InstructorRepository.java
  • src/main/java/ditda/backend/domain/instructor/service/InstructorService.java
  • src/main/resources/application.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/ditda/backend/domain/instructor/facade/InstructorFacade.java
  • src/main/java/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java

📝 Walkthrough

Walkthrough

강사 마이페이지 기능을 위한 두 개의 API를 추가한다. GET /api/v1/instructors/me는 강사 프로필 및 외주 통계(총 이용 횟수, 진행 중 건수)를 반환하고, GET /api/v1/instructors/commissions는 페이지네이션 기반 외주 내역을 반환한다. 이를 위해 CommissionStatus에 진행 중 상태 집합을, 결제/커미션 저장소에 집계 쿼리를, 파사드·서비스·응답 DTO 계층을 신규 추가한다.

Changes

강사 마이페이지 API 구현

Layer / File(s) Summary
결제 프로젝션 및 CommissionStatus 진행 상태 정의
src/main/java/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java, src/main/java/ditda/backend/domain/payment/repository/projection/CommissionPaidAmount.java, src/main/resources/application.yaml
CommissionStatusRECRUITING, IN_PROGRESS, EDITING을 포함하는 ONGOING 정적 집합과 ongoingStatuses() 메서드를 추가하고, 결제 완료 금액 조회용 CommissionPaidAmount 프로젝션 인터페이스를 신규 정의하며, 페이지네이션 기본값(page-size: 10, max-page-size: 30)을 설정한다.
저장소 쿼리 메서드 확장
src/main/java/ditda/backend/domain/commission/core/repository/CommissionRepository.java, src/main/java/ditda/backend/domain/payment/repository/PaymentRepository.java
CommissionRepositorycountByInstructorIdAndStatusIn 파생 쿼리를 추가하고, PaymentRepositoryfindPaidAmounts(JPQL, 프로젝션 반환)·countByInstructorIdAndStatus(JPQL) 메서드를 추가한다.
PaymentService 및 InstructorCommissionService 조회 메서드
src/main/java/ditda/backend/domain/payment/service/PaymentService.java, src/main/java/ditda/backend/domain/commission/core/service/InstructorCommissionService.java
PaymentServicegetPaidAmounts(커미션 ID→금액 맵)·countPaidCommissions(완료 건수)를, InstructorCommissionServicecountOngoingCommissions(진행 중 건수)를 읽기 전용 트랜잭션으로 추가하여 통계 집계 기반을 마련한다.
강사 외주 내역 조회 레이어
src/main/java/ditda/backend/domain/commission/history/repository/CommissionHistoryRepository.java, src/main/java/ditda/backend/domain/commission/history/service/CommissionHistoryService.java, src/main/java/ditda/backend/domain/commission/history/facade/InstructorCommissionHistoryFacade.java, src/main/java/ditda/backend/domain/commission/history/dto/response/InstructorCommissionHistoryResponse.java, src/main/java/ditda/backend/domain/commission/history/controller/InstructorCommissionHistoryController.java
CommissionHistoryRepositoryCommissionHistoryServiceInstructorCommissionHistoryFacade 순으로 커미션 페이징 조회와 결제 금액 조합 흐름을 구성하고, InstructorCommissionHistoryResponse(중첩 CommissionItem 포함) DTO와 createdAt 내림차순 정렬 로직이 포함된 컨트롤러로 GET /api/v1/instructors/commissions를 완성한다.
강사 통계 조회 레이어
src/main/java/ditda/backend/domain/instructor/repository/InstructorRepository.java, src/main/java/ditda/backend/domain/instructor/service/InstructorService.java, src/main/java/ditda/backend/domain/instructor/dto/response/InstructorStatsResponse.java, src/main/java/ditda/backend/domain/instructor/mapper/InstructorResponseMapper.java, src/main/java/ditda/backend/domain/instructor/facade/InstructorFacade.java, src/main/java/ditda/backend/domain/instructor/controller/InstructorController.java
InstructorRepository.findByIdWithUser(JOIN FETCH), InstructorService.getByIdWithUser, InstructorStatsResponse(총 이용 횟수·진행 중 건수 포함) DTO, S3 URL 변환을 담당하는 InstructorResponseMapper, 두 집계 서비스를 조합하는 InstructorFacade, GET /api/v1/instructors/me 엔드포인트를 제공하는 InstructorController를 신규 추가한다.

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~
Loading
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~
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Suggested reviewers

  • fervovita
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 주요 변경사항을 명확하게 요약하며, 강사 마이페이지의 본인 정보, 통계 및 외주 내역 조회 기능 추가를 잘 나타냅니다.
Linked Issues check ✅ Passed PR은 #39의 모든 요구사항을 충족합니다. GET /api/v1/instructors/me (통계 조회)와 GET /api/v1/instructors/commissions (외주 내역 조회) 두 API가 모두 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항은 강사 마이페이지 기능 구현과 직접 관련이 있으며, 지정된 요구사항 범위 내에 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/#39-instructor-mypage

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.

@Jong0128 Jong0128 self-assigned this Jun 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java (1)

18-19: 🧹 Nitpick | 🔵 Trivial

mutable 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0d20ce0 and 6307d7b.

📒 Files selected for processing (15)
  • src/main/java/ditda/backend/domain/commission/core/entity/enums/CommissionStatus.java
  • src/main/java/ditda/backend/domain/commission/core/repository/CommissionRepository.java
  • src/main/java/ditda/backend/domain/commission/core/service/InstructorCommissionService.java
  • src/main/java/ditda/backend/domain/commission/history/controller/InstructorCommissionHistoryController.java
  • src/main/java/ditda/backend/domain/commission/history/dto/response/InstructorCommissionHistoryResponse.java
  • src/main/java/ditda/backend/domain/commission/history/facade/InstructorCommissionHistoryFacade.java
  • src/main/java/ditda/backend/domain/commission/history/repository/CommissionHistoryRepository.java
  • src/main/java/ditda/backend/domain/commission/history/service/CommissionHistoryService.java
  • src/main/java/ditda/backend/domain/instructor/controller/InstructorController.java
  • src/main/java/ditda/backend/domain/instructor/dto/response/InstructorStatsResponse.java
  • src/main/java/ditda/backend/domain/instructor/facade/InstructorFacade.java
  • src/main/java/ditda/backend/domain/instructor/mapper/InstructorResponseMapper.java
  • src/main/java/ditda/backend/domain/payment/repository/PaymentRepository.java
  • src/main/java/ditda/backend/domain/payment/repository/projection/CommissionPaidAmount.java
  • src/main/java/ditda/backend/domain/payment/service/PaymentService.java

@fervovita fervovita left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

수고하셨어요!!!
아래 코멘트 확인 부탁드립니다😄

@fervovita fervovita self-requested a review June 23, 2026 09:33
@Jong0128 Jong0128 merged commit f26cf15 into dev Jun 23, 2026
2 checks passed
@Jong0128 Jong0128 deleted the feat/#39-instructor-mypage branch June 23, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 강사 마이페이지 본인 정보 + 통계 및 외주 내역 조회

2 participants