From 5eb00cf4e7118ef83f51e28a6c82f5504c40bfab Mon Sep 17 00:00:00 2001 From: Jiwon Date: Sat, 29 Jul 2023 16:36:38 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[refactor]=20=EA=B2=80=EC=83=89=20=EC=BB=A8?= =?UTF-8?q?=ED=8A=B8=EB=A1=A4=EB=9F=AC=EB=9E=91=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=EB=A1=9C=EC=A7=81=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/shop/hooking/hooking/config/OAuth2SuccessHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/shop/hooking/hooking/config/OAuth2SuccessHandler.java b/src/main/java/shop/hooking/hooking/config/OAuth2SuccessHandler.java index e5b9681..e958d3d 100644 --- a/src/main/java/shop/hooking/hooking/config/OAuth2SuccessHandler.java +++ b/src/main/java/shop/hooking/hooking/config/OAuth2SuccessHandler.java @@ -67,7 +67,6 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo targetUrl = "http://localhost:3000/oath-processor"; // 로컬 환경 } else if (referer != null && referer.startsWith("https://hooking.me/") && host.equals("hooking.shop")) { targetUrl = "https://hooking.me/oath-processor"; // 실배포 환경 - } else { // 기본적으로 로컬 개발 환경으로 설정 From dc71e2f63edbfaa26b8df3108dc836d041da58cb Mon Sep 17 00:00:00 2001 From: Jiwon Date: Sat, 29 Jul 2023 17:20:20 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[refactor]=20=EC=B7=A8=EC=86=8C=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/hooking/hooking/controller/CopyController.java | 9 +++++---- .../shop/hooking/hooking/repository/ScrapRepository.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/shop/hooking/hooking/controller/CopyController.java b/src/main/java/shop/hooking/hooking/controller/CopyController.java index 85b6311..bc86a2f 100644 --- a/src/main/java/shop/hooking/hooking/controller/CopyController.java +++ b/src/main/java/shop/hooking/hooking/controller/CopyController.java @@ -161,17 +161,18 @@ public ResponseEntity> searchFilterCard(HttpServletRequest httpReq // 카피라이팅 스크랩 취소 (soft delete) - @PostMapping ("/scrap/cancel") - public ResponseEntity cancelScrap(HttpServletRequest httpRequest, @RequestBody CopyReq copyReq){ + @PostMapping ("/scrap/cancle") + public ResponseEntity> cancelScrap(HttpServletRequest httpRequest, @RequestBody CopyReq copyReq){ User user = jwtTokenProvider.getUserInfoByToken(httpRequest); Long cardId = copyReq.getCardId(); Card card = cardRepository.findCardById(cardId); boolean is_canceled = copyService.cancelScrap(user, card); if(is_canceled){ - return ResponseEntity.status(HttpStatus.OK).body("삭제되었습니다."); + return ResponseEntity.ok(new HttpRes<>("해당 스크랩을 삭제했습니다.")); } else{ - return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("스크랩 정보가 유효하지 않습니다."); + String errorMessage = "스크랩 정보가 유효하지 않습니다."; + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new HttpRes<>(HttpStatus.BAD_REQUEST.value(), errorMessage)); } } diff --git a/src/main/java/shop/hooking/hooking/repository/ScrapRepository.java b/src/main/java/shop/hooking/hooking/repository/ScrapRepository.java index a8fdcb1..d9b2a17 100644 --- a/src/main/java/shop/hooking/hooking/repository/ScrapRepository.java +++ b/src/main/java/shop/hooking/hooking/repository/ScrapRepository.java @@ -14,7 +14,7 @@ public interface ScrapRepository extends JpaRepository { @Override List findAll(); - List findScrapByUser(User user); + List findScrapByUser(User user); //여기서 최신순으로 가져오게 List findByCardId(Long id); // 카드 식별번호로 스크랩 객체 찾기