Skip to content

Comments

refactor: Report 응답 DTO N+1 문제 해결#163

Merged
LeeShinHaeng merged 4 commits intodevfrom
refactor/report-response-dto-n1
Feb 18, 2026
Merged

refactor: Report 응답 DTO N+1 문제 해결#163
LeeShinHaeng merged 4 commits intodevfrom
refactor/report-response-dto-n1

Conversation

@LeeShinHaeng
Copy link
Contributor

📋 상세 설명

  • ReportConverter에서 UserSummary 조회 과정에서 하다보니 코드 상의 N+1 문제가 발생했습니다.
    • ReportConverter의 메서드를 호출하는 쪽에서 IN 절로 조회 후 넘겨주는 방식으로 해결했습니다.
  • 확인 중 특정 상태를 조회하는 API로 모든 신고를 조회할 수 있음을 확인했습니다.
    • ReportStatusNotMatchException를 생성해 현재 신고의 상태와 동일하지 않은 API로 조회할 경우 예외처리를 했습니다.
    • ReportService의 reportStatusValid()에서 검증을 담당합니다.

📊 체크리스트

  • PR 제목이 형식에 맞나요 e.g. feat: PR을 등록한다
  • 코드가 테스트 되었나요
  • 문서는 업데이트 되었나요
  • 불필요한 코드를 제거했나요
  • 이슈와 라벨이 등록되었나요

📆 마감일

Close #156

@LeeShinHaeng LeeShinHaeng self-assigned this Feb 16, 2026
@LeeShinHaeng LeeShinHaeng added 🔧fix 버그 해결 🛠️refactor 리팩토링 작업 labels Feb 16, 2026
@LeeShinHaeng LeeShinHaeng linked an issue Feb 16, 2026 that may be closed by this pull request
1 task
@github-actions
Copy link

github-actions bot commented Feb 16, 2026

Unit Test Results

  39 files  ±0    39 suites  ±0   5s ⏱️ -1s
127 tests ±0  127 ✔️ ±0  0 💤 ±0  0 ±0 
128 runs  ±0  128 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit da5bdfe. ± Comparison against base commit c0fae9f.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 89.36170% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...y/dcs/domain/report/application/ReportService.java 87.80% 1 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@bsko98 bsko98 left a comment

Choose a reason for hiding this comment

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

설 연휴에도 고생이 많으십니다!! 전 처음엔 몰랐는데 코파일럿 덕분에 N+1 문제가 될 수 있었다는걸 알았네요...

확인 중 특정 상태를 조회하는 API로 모든 신고를 조회할 수 있음을 확인했습니다.
이 부분은 혹시 특정 상태를 조회하면 상태 상관없이 모든 신고를 조회할 수 있다는건가요?!

# Conflicts:
#	src/main/java/until/the/eternity/dcs/domain/report/application/ReportService.java
#	src/test/java/until/the/eternity/dcs/domain/report/application/ReportConverterTest.java
@LeeShinHaeng
Copy link
Contributor Author

확인 중 특정 상태를 조회하는 API로 모든 신고를 조회할 수 있음을 확인했습니다.
이 부분은 혹시 특정 상태를 조회하면 상태 상관없이 모든 신고를 조회할 수 있다는건가요?!

기존에 /api/reports의 reported/{id}, replied/{id}, revived/{id} 로 API는 분리가 되어 있었지만, 상태에 상관없이 아이디만 일치하면 조회가 가능했습니다.
때문에 각 API의 로직에 reportStatusValid() 메서드를 호출하도록 추가해서 만약 일치하지 않는 경우 예외로 처리하도록 변경했습니다!

@LeeShinHaeng LeeShinHaeng merged commit 3b94de6 into dev Feb 18, 2026
3 checks passed
@LeeShinHaeng LeeShinHaeng deleted the refactor/report-response-dto-n1 branch February 18, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧fix 버그 해결 🛠️refactor 리팩토링 작업

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report 관련 Response DTO 생성 시 User 조회 N+1 문제 발생

2 participants