Skip to content

Commit

Permalink
Merge pull request #25 from Likelion-Kwangwoon/Board
Browse files Browse the repository at this point in the history
editPost 수정중
  • Loading branch information
ImNuam authored Apr 8, 2023
2 parents 8391837 + 876e4bb commit 9e81597
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/likelion/dub/controller/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ public BaseResponse<String> deletePost(@RequestParam(value="id",required = true)
String result = "동아리 게시글 삭제 완료";
return new BaseResponse<>(result);
}
@PutMapping("/edit-post")
public BaseResponse<String> editPost(@RequestPart(value="json") PostEditRequest dto, @RequestPart(value="images", required = false) List<MultipartFile> images) throws BaseException{
String newTitle = dto.getTitle();
String newContent = dto.getContent();
int newCategory = dto.getCategory();
List<MultipartFile> newImages = images;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
//jwt token 오류
if (authentication == null || !authentication.isAuthenticated()) {
return new BaseResponse(BaseResponseStatus.JWT_TOKEN_ERROR);
}
String email = authentication.getName();

postService.editPost(email, newTitle, newContent, newCategory, newImages);

return new BaseResponse<>(BaseResponseStatus.SUCCESS);
}

}

0 comments on commit 9e81597

Please sign in to comment.