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);