Skip to content

Commit

Permalink
refactor(PostCrudController): 포토카드 저장안됨 이슈 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jiminseon committed Dec 7, 2023
1 parent 14db9a8 commit b4dc3ed
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class PostCrudController {
//포토카드 작성 multipartFile 사용시 RequestPart 사용해야함.

@PostMapping(value = "/posts/add-post",consumes = {MediaType.APPLICATION_JSON_VALUE,MediaType.MULTIPART_FORM_DATA_VALUE})
public BaseResponse<PostBackDto> create(@RequestPart PostBackDto post, @ModelAttribute MultipartFile multipartFile) throws IOException {
public BaseResponse<PostBackDto> create(@RequestPart PostBackDto post, @ModelAttribute MultipartFile image) throws IOException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

if(authentication == null)
Expand All @@ -40,7 +40,7 @@ public BaseResponse<PostBackDto> create(@RequestPart PostBackDto post, @ModelAtt
Long id = ((PrincipalDetails) authentication.getPrincipal()).getId();

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

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

0 comments on commit b4dc3ed

Please sign in to comment.