From 5b3c9f10cf32a8fde7b87651d4869472a1dd2830 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 4 Jan 2024 21:45:25 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=EC=88=98=EC=9A=94=EC=A1=B0=EC=82=AC?= =?UTF-8?q?=20=EB=93=B1=EB=A1=9D=ED=8F=BC=20=EC=83=81=EC=84=B8=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=EC=A0=91=EA=B7=BC=20=EA=B6=8C=ED=95=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20#137?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyDemandProject/controller/MyDemandProjectController.java | 4 ++-- .../MyDemandProject/service/MyDemandProjectService.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/controller/MyDemandProjectController.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/controller/MyDemandProjectController.java index 8cfd5f9..1b3cb91 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/controller/MyDemandProjectController.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/controller/MyDemandProjectController.java @@ -32,8 +32,8 @@ public ResponseEntity updateMyDemandFormStatus(@PathVariable Long demand_project } @GetMapping("/detail/{demand_project_id}") - public MyDemandDetailResponseDto getMyDemandDetailForm(@PathVariable Long demand_project_id){ - return myDemandProjectService.findMyDemandFormDetail(demand_project_id); + public MyDemandDetailResponseDto getMyDemandDetailForm(@PathVariable Long demand_project_id, @AuthenticationPrincipal User user){ + return myDemandProjectService.findMyDemandFormDetail(demand_project_id, user); } diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/service/MyDemandProjectService.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/service/MyDemandProjectService.java index 19c520c..d5bfaf7 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/service/MyDemandProjectService.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MyDemandProject/service/MyDemandProjectService.java @@ -50,8 +50,10 @@ public ResponseEntity updateMyDemandFormStatus(Long demand_project_id){ } @Transactional(readOnly = true) - public MyDemandDetailResponseDto findMyDemandFormDetail(Long demand_project_id){ + public MyDemandDetailResponseDto findMyDemandFormDetail(Long demand_project_id, User user){ DemandProject project = demandProjectRepository.findById(demand_project_id).get(); + if (user == null || project.getUser().getId() != user.getId()) + throw new ResponseStatusException(HttpStatus.BAD_REQUEST); List demandItems = demandItemRepository.findDemandItemByDemandProject_Id(demand_project_id); List itemList = demandItems.stream().map(MyDemandItemDto::new).collect(Collectors.toList()); MyDemandDetailResponseDto responseDto = new MyDemandDetailResponseDto(itemList, project);