feat: 받은 매칭 조회에 신청 견 정보 포함 (수락/거절 UI용)
CI / build (push) Failing after 11m22s

GET /api/matches/received/{dogId} → 신청 견 이름·견종 포함(ReceivedMatchResponse).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
sb
2026-07-11 15:04:20 +09:00
parent f6882aef44
commit ca14f8ee64
3 changed files with 34 additions and 5 deletions
@@ -2,6 +2,7 @@ package com.dog.dognation.api;
import com.dog.dognation.api.dto.CreateMatchRequest;
import com.dog.dognation.api.dto.MatchResponse;
import com.dog.dognation.api.dto.ReceivedMatchResponse;
import com.dog.dognation.domain.matching.MatchingRequest;
import com.dog.dognation.domain.matching.MatchingService;
import jakarta.validation.Valid;
@@ -46,12 +47,10 @@ public class MatchingController {
return MatchResponse.from(matchingService.respond(id, false));
}
/** 특정 견이 받은 대기중 신청 목록. */
/** 특정 견이 받은 대기중 신청 목록 (신청 견 정보 포함). */
@GetMapping("/received/{dogId}")
public List<MatchResponse> received(@PathVariable Long dogId) {
return matchingService.findPendingReceived(dogId).stream()
.map(MatchResponse::from)
.toList();
public List<ReceivedMatchResponse> received(@PathVariable Long dogId) {
return matchingService.receivedDetail(dogId);
}
/** 특정 견이 보낸 대기중 신청 목록 (진행중 표시용). */
@@ -0,0 +1,14 @@
package com.dog.dognation.api.dto;
import java.time.OffsetDateTime;
/** 받은 매칭 신청 — 수락/거절 UI용. 신청 견 정보 포함. */
public record ReceivedMatchResponse(
Long id,
Long requesterDogId,
String requesterDogName,
String requesterDogBreed,
OffsetDateTime createdAt,
OffsetDateTime expiresAt
) {
}
@@ -1,6 +1,7 @@
package com.dog.dognation.domain.matching;
import com.dog.dognation.api.dto.MatchNotification;
import com.dog.dognation.api.dto.ReceivedMatchResponse;
import com.dog.dognation.domain.chat.ChatService;
import com.dog.dognation.domain.dog.Dog;
import com.dog.dognation.domain.dog.DogRepository;
@@ -126,6 +127,21 @@ public class MatchingService {
targetDogId, MatchingStatus.PENDING);
}
/** 받은 대기중 신청 — 수락/거절 UI용(신청 견 정보 포함). */
@Transactional(readOnly = true)
public List<ReceivedMatchResponse> receivedDetail(Long targetDogId) {
List<MatchingRequest> reqs = matchingRequestRepository
.findByTargetDogIdAndStatusOrderByCreatedAtDesc(targetDogId, MatchingStatus.PENDING);
return reqs.stream().map(r -> {
Dog d = dogRepository.findById(r.getRequesterDogId()).orElse(null);
return new ReceivedMatchResponse(
r.getId(), r.getRequesterDogId(),
d != null ? d.getName() : "알 수 없음",
d != null ? d.getBreed() : null,
r.getCreatedAt(), r.getExpiresAt());
}).toList();
}
/** 내가 보낸 대기중 신청 — 프론트 "진행중" 표시용. */
@Transactional(readOnly = true)
public List<MatchingRequest> findSentPending(Long requesterDogId) {