From 79321fde7a1296e90dae0fa4a6ccf4137fe0bbcb Mon Sep 17 00:00:00 2001 From: dldmldlsy Date: Thu, 18 Jan 2024 09:50:20 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=84=A4=EA=B3=A0=20=EA=B0=80=EB=8A=A5?= =?UTF-8?q?=20=EC=97=AC=EB=B6=80=20=EC=A1=B0=ED=9A=8C=20API=20controller?= =?UTF-8?q?=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 네고 가능 여부 조회 API controller 메서드 추가 --- .../domain/nego/controller/NegoController.java | 9 ++++++++- .../domain/nego/service/NegoServiceImpl.java | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/site/goldenticket/domain/nego/controller/NegoController.java b/src/main/java/site/goldenticket/domain/nego/controller/NegoController.java index 55d42851..a05c9b36 100644 --- a/src/main/java/site/goldenticket/domain/nego/controller/NegoController.java +++ b/src/main/java/site/goldenticket/domain/nego/controller/NegoController.java @@ -4,10 +4,10 @@ import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; -import org.testcontainers.shaded.org.checkerframework.checker.units.qual.C; import site.goldenticket.common.response.CommonResponse; import site.goldenticket.domain.nego.dto.request.PriceProposeRequest; import site.goldenticket.domain.nego.dto.response.HandoverResponse; +import site.goldenticket.domain.nego.dto.response.NegoAvailableResponse; import site.goldenticket.domain.nego.dto.response.NegoResponse; import site.goldenticket.domain.nego.dto.response.PayResponse; import site.goldenticket.domain.nego.dto.response.PriceProposeResponse; @@ -63,4 +63,11 @@ public ResponseEntity> denyhandoverProduct(@PathVar return ResponseEntity.ok(CommonResponse.ok("양도가 거절되었습니다", response)); } + @GetMapping("/available") + public ResponseEntity> getNegoAvailable( + @RequestParam(name = "productId") Long productId, + @AuthenticationPrincipal PrincipalDetails principalDetails) { + return ResponseEntity.ok(CommonResponse.ok("네고 가능 여부가 조회되었습니다", + negoService.isAvailableNego(principalDetails.getUserId(), productId))); + } } diff --git a/src/main/java/site/goldenticket/domain/nego/service/NegoServiceImpl.java b/src/main/java/site/goldenticket/domain/nego/service/NegoServiceImpl.java index 47dfd000..f0db726e 100644 --- a/src/main/java/site/goldenticket/domain/nego/service/NegoServiceImpl.java +++ b/src/main/java/site/goldenticket/domain/nego/service/NegoServiceImpl.java @@ -288,7 +288,6 @@ public NegoAvailableResponse isAvailableNego(Long userId, Long productId) { ChatRoom chatRoom = chatService.createChatRoom(userId, productId); negoAvailable = true; chatRoomId = chatRoom.getId(); - System.out.println(chatRoomId); } } else { //네고 이력 있는 경우 : 2차 네고(거절 혹은 승인) OR 재결제 -> 네고 불가