From ca14f8ee645f7b8c5cd22cce27647bf258de1107 Mon Sep 17 00:00:00 2001 From: sb Date: Sat, 11 Jul 2026 15:04:20 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B0=9B=EC=9D=80=20=EB=A7=A4=EC=B9=AD?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EC=97=90=20=EC=8B=A0=EC=B2=AD=20=EA=B2=AC?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=20=ED=8F=AC=ED=95=A8=20(=EC=88=98?= =?UTF-8?q?=EB=9D=BD/=EA=B1=B0=EC=A0=88=20UI=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GET /api/matches/received/{dogId} → 신청 견 이름·견종 포함(ReceivedMatchResponse). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../dog/dognation/api/MatchingController.java | 9 ++++----- .../dognation/api/dto/ReceivedMatchResponse.java | 14 ++++++++++++++ .../domain/matching/MatchingService.java | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/dog/dognation/api/dto/ReceivedMatchResponse.java diff --git a/src/main/java/com/dog/dognation/api/MatchingController.java b/src/main/java/com/dog/dognation/api/MatchingController.java index dc0b570..3e9872c 100644 --- a/src/main/java/com/dog/dognation/api/MatchingController.java +++ b/src/main/java/com/dog/dognation/api/MatchingController.java @@ -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 received(@PathVariable Long dogId) { - return matchingService.findPendingReceived(dogId).stream() - .map(MatchResponse::from) - .toList(); + public List received(@PathVariable Long dogId) { + return matchingService.receivedDetail(dogId); } /** 특정 견이 보낸 대기중 신청 목록 (진행중 표시용). */ diff --git a/src/main/java/com/dog/dognation/api/dto/ReceivedMatchResponse.java b/src/main/java/com/dog/dognation/api/dto/ReceivedMatchResponse.java new file mode 100644 index 0000000..9da80c8 --- /dev/null +++ b/src/main/java/com/dog/dognation/api/dto/ReceivedMatchResponse.java @@ -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 +) { +} \ No newline at end of file diff --git a/src/main/java/com/dog/dognation/domain/matching/MatchingService.java b/src/main/java/com/dog/dognation/domain/matching/MatchingService.java index bdf64e7..17767b1 100644 --- a/src/main/java/com/dog/dognation/domain/matching/MatchingService.java +++ b/src/main/java/com/dog/dognation/domain/matching/MatchingService.java @@ -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 receivedDetail(Long targetDogId) { + List 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 findSentPending(Long requesterDogId) {