Skip to content

Commit

Permalink
Merge pull request #150 from UMC-WOWMARKET/feat/MyOrderManage-137
Browse files Browse the repository at this point in the history
[feat] 수요조사 등록폼 상세보기 접근 권한 설정 #137
  • Loading branch information
yunji118 authored Jan 4, 2024
2 parents 6af60e7 + 5b3c9f1 commit 672b869
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<DemandItem> demandItems = demandItemRepository.findDemandItemByDemandProject_Id(demand_project_id);
List<MyDemandItemDto> itemList = demandItems.stream().map(MyDemandItemDto::new).collect(Collectors.toList());
MyDemandDetailResponseDto responseDto = new MyDemandDetailResponseDto(itemList, project);
Expand Down

0 comments on commit 672b869

Please sign in to comment.