-
Notifications
You must be signed in to change notification settings - Fork 0
feat: internal 추가 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.example.matching.controller; | ||
|
|
||
| import com.example.matching.dto.response.InternalMatchingResponse; | ||
| import com.example.matching.service.MatchingService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @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)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package com.example.matching.dto.response; | ||
|
|
||
| import com.example.matching.entity.Matching; | ||
| import com.example.matching.entity.MatchingStatus; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| public record InternalMatchingResponse( | ||
| @JsonProperty("matching_id") | ||
| Long matchingId, | ||
|
|
||
| @JsonProperty("space_id") | ||
| Long spaceId, | ||
|
|
||
| @JsonProperty("host_id") | ||
| String hostId, | ||
|
|
||
| @JsonProperty("seller_id") | ||
| String sellerId, | ||
|
|
||
| @JsonProperty("start_time") | ||
| LocalDateTime startTime, | ||
|
|
||
| @JsonProperty("end_time") | ||
| LocalDateTime endTime, | ||
|
|
||
| @JsonProperty("total_price") | ||
| Integer totalPrice, | ||
|
|
||
| MatchingStatus status, | ||
|
|
||
| @JsonProperty("created_at") | ||
| LocalDateTime createdAt, | ||
|
|
||
| @JsonProperty("updated_at") | ||
| LocalDateTime updatedAt | ||
| ) { | ||
|
|
||
| public static InternalMatchingResponse from(Matching matching) { | ||
| return new InternalMatchingResponse( | ||
| matching.getId(), | ||
| matching.getSpaceId(), | ||
| matching.getHostId(), | ||
| matching.getSellerId(), | ||
| matching.getStartTime(), | ||
| matching.getEndTime(), | ||
| matching.getTotalPrice(), | ||
| matching.getStatus(), | ||
| matching.getCreatedAt(), | ||
| matching.getUpdatedAt() | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import com.example.matching.client.SpaceClient; | ||
| import com.example.matching.client.dto.SpaceMatchingContextResponse; | ||
| import com.example.matching.dto.request.MatchingCreateRequest; | ||
| import com.example.matching.dto.response.InternalMatchingResponse; | ||
| import com.example.matching.dto.response.MatchingCreateResponse; | ||
| import com.example.matching.dto.response.MatchingListResponse; | ||
| import com.example.matching.dto.response.MatchingSearchResponse; | ||
|
|
@@ -69,6 +70,11 @@ public MatchingListResponse getSentMatchings(String userId) { | |
| return toListResponse(matchingRepository.findBySellerIdOrderByCreatedAtDesc(userId)); | ||
| } | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public InternalMatchingResponse getMatchingForInternal(Long matchingId) { | ||
| return InternalMatchingResponse.from(getMatching(matchingId)); | ||
| } | ||
|
Comment on lines
+73
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 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 테스트 추가 필요 🤖 Prompt for AI Agents |
||
|
|
||
| @Transactional | ||
| public void approve(String userId, Long matchingId) { | ||
| Matching matching = getMatching(matchingId); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: MomentLit/Matching
Length of output: 3498
🏁 Script executed:
Repository: MomentLit/Matching
Length of output: 4511
🏁 Script executed:
Repository: 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