Skip to content

Commit

Permalink
[feat]판매 등록폼 상세보기 접근 권한 설정 #154
Browse files Browse the repository at this point in the history
  • Loading branch information
yunji118 committed Jan 9, 2024
1 parent 04a0d9d commit 1098e16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public ResponseEntity finishMySales(@PathVariable Long project_id, @Authenticati

//판매 등록폼 상세보기
@GetMapping("/detail/{project_id}")
public MySalesDetailResponseDto getMySalesDetail(@PathVariable Long project_id){
return mySalesProjectService.findMySalesDetail(project_id);
public MySalesDetailResponseDto getMySalesDetail(@PathVariable Long project_id, @AuthenticationPrincipal User user){
return mySalesProjectService.findMySalesDetail(project_id, user);
}

//판매 등록폼 수정하기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public ResponseEntity finishMySalesForm(Long project_id, User user){
}

@Transactional(readOnly = true)
public MySalesDetailResponseDto findMySalesDetail(Long project_id){
public MySalesDetailResponseDto findMySalesDetail(Long project_id, User user){
Project project = projectRepository.findById(project_id).get();
if (user == null || user.getId() != project.getUser().getId()){
throw new ResponseStatusException(HttpStatus.BAD_REQUEST);
}
List<Item> itemList = itemRepository.findByProject_Id(project_id);
List<MySalesItemDto> itemDtos = itemList.stream().map(MySalesItemDto::new).collect(Collectors.toList());

Expand Down

0 comments on commit 1098e16

Please sign in to comment.