feat: internal 추가 - #15
Conversation
📝 WalkthroughWalkthrough내부 매칭 조회 API가 추가되었다. 매칭 정보를 내부 응답 DTO로 변환하며, 서비스 조회 메서드와 Changes내부 매칭 조회 API
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant InternalMatchingController
participant MatchingService
participant InternalMatchingResponse
Client->>InternalMatchingController: GET /internal/matchings/{matching-id}
InternalMatchingController->>MatchingService: getMatchingForInternal(matchingId)
MatchingService->>InternalMatchingResponse: from(Matching)
InternalMatchingResponse-->>MatchingService: 응답 DTO
MatchingService-->>InternalMatchingController: InternalMatchingResponse
InternalMatchingController-->>Client: 200 OK
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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.
Actionable comments posted: 2
🤖 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.
Inline comments:
In
`@src/main/java/com/example/matching/controller/InternalMatchingController.java`:
- Around line 12-24: Update SecurityConfig to require authentication for the
/internal/** endpoint pattern, ensuring InternalMatchingController is not
covered by the catch-all permitAll rule. Preserve the existing /matchings/**
authentication rule and other public endpoint behavior.
In `@src/main/java/com/example/matching/service/MatchingService.java`:
- Around line 73-76: Extend MatchingServiceTest with coverage for
getMatchingForInternal: verify it returns the expected InternalMatchingResponse
for a valid matchingId and throws MatchingNotFoundException when the matching
record is absent, reusing the existing test setup and fixtures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 928ed9cd-9d29-48a1-ac33-77f99410ea00
📒 Files selected for processing (4)
src/main/java/com/example/matching/controller/InternalMatchingController.javasrc/main/java/com/example/matching/dto/response/InternalMatchingResponse.javasrc/main/java/com/example/matching/service/MatchingService.javasrc/test/resources/application.yaml
| @RestController | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/internal/matchings") | ||
| public class InternalMatchingController { | ||
|
|
||
| private final MatchingService matchingService; | ||
|
|
||
| @GetMapping("/{matching-id}") | ||
| public ResponseEntity<InternalMatchingResponse> getMatching( | ||
| @PathVariable("matching-id") Long matchingId | ||
| ) { | ||
| return ResponseEntity.ok(matchingService.getMatchingForInternal(matchingId)); | ||
| } |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: /internal/ 경로에 대한 보안 설정 확인
rg -n 'internal' --type java src/main/java/ -g '!**/controller/**' -C3
rg -n 'SecurityConfig|WebSecurityConfig|SecurityFilterChain' --type java src/main/java/ -C5Repository: MomentLit/Matching
Length of output: 3498
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,220p' src/main/java/com/example/matching/global/config/SecurityConfig.java
printf '\n---\n'
rg -n '/internal/|/internal\\*\\*|hasRole|hasAuthority|permitAll|authenticated|anyRequest' src/main/java/com/example/matching -C2
printf '\n---\n'
sed -n '1,220p' src/main/java/com/example/matching/controller/InternalMatchingController.javaRepository: MomentLit/Matching
Length of output: 4511
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,260p' src/main/java/com/example/matching/global/security/JwtFilter.java
printf '\n---\n'
rg -n 'EnableMethodSecurity|PreAuthorize|Secured|RolesAllowed' src/main/java/com/example/matching -C2Repository: MomentLit/Matching
Length of output: 2323
/internal/matchings 인증 규칙 추가 필요
src/main/java/com/example/matching/global/config/SecurityConfig.java에서 /matchings/**만 authenticated()로 묶고 나머지는 permitAll()이라, 이 내부 엔드포인트는 애플리케이션 레벨에서 공개 상태입니다. hostId/sellerId가 포함된 응답이 나가므로 /internal/**에 대한 인증 규칙이나 @PreAuthorize를 추가하세요.
🤖 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/example/matching/controller/InternalMatchingController.java`
around lines 12 - 24, Update SecurityConfig to require authentication for the
/internal/** endpoint pattern, ensuring InternalMatchingController is not
covered by the catch-all permitAll rule. Preserve the existing /matchings/**
authentication rule and other public endpoint behavior.
| @Transactional(readOnly = true) | ||
| public InternalMatchingResponse getMatchingForInternal(Long matchingId) { | ||
| return InternalMatchingResponse.from(getMatching(matchingId)); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: getMatchingForInternal 메서드에 대한 테스트 존재 여부 확인
rg -n 'getMatchingForInternal' --type java src/test/Repository: MomentLit/Matching
Length of output: 156
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 테스트 파일/관련 메서드 위치와 현재 구현 확인
git ls-files 'src/test/**/*.java' 'src/main/**/*.java' | rg 'MatchingService|Matching'
printf '\n--- service snippet ---\n'
sed -n '1,180p' src/main/java/com/example/matching/service/MatchingService.java
printf '\n--- test snippets ---\n'
for f in $(git ls-files 'src/test/**/*.java' | rg 'MatchingService|Matching'); do
echo "### $f"
sed -n '1,240p' "$f"
doneRepository: MomentLit/Matching
Length of output: 15471
getMatchingForInternal 테스트 추가 필요
MatchingServiceTest에 getMatchingForInternal의 정상 조회와 MatchingNotFoundException 케이스를 추가해 주세요.
🤖 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/example/matching/service/MatchingService.java` around lines
73 - 76, Extend MatchingServiceTest with coverage for getMatchingForInternal:
verify it returns the expected InternalMatchingResponse for a valid matchingId
and throws MatchingNotFoundException when the matching record is absent, reusing
the existing test setup and fixtures.
#️⃣ 연관된 이슈
📝 작업 내용
💻 스크린샷 (선택)
💬 리뷰 요청 사항 (선택)
Summary by CodeRabbit
새 기능
테스트