Skip to content

Commit

Permalink
refactor(PostCrudController): 포토카드 저장안됨 이슈 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jiminseon committed Dec 6, 2023
1 parent 233303c commit 5b86f05
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public class PostCrudController {
//포토카드 작성 multipartFile 사용시 RequestPart 사용해야함.
@ResponseBody
@PostMapping(value = "/posts/add-post",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public BaseResponse<PostBackDto> create(@RequestPart PostBackDto post, @RequestPart(value = "image", required = false)MultipartFile image) throws IOException {
public BaseResponse<PostBackDto> create(@RequestPart PostBackDto post, @RequestPart(value = "cardImage", required = false)MultipartFile multipartFile) throws IOException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

if(authentication == null)
return new BaseResponse<>(BaseResponseStatus.FAILED_NOT_AUTHENTICATION);

Long id = ((PrincipalDetails) authentication.getPrincipal()).getId();

String S3FileName = fileUploadService.upload(image);
String S3FileName = fileUploadService.upload(multipartFile);
postCrudService.savePost(post, S3FileName, id);

return new BaseResponse<>(post, BaseResponseStatus.SUCCESS_CREATE_POST);
Expand Down

0 comments on commit 5b86f05

Please sign in to comment.