diff --git a/src/main/java/com/bapMate/bapMateServer/domain/meeting/controller/MeetUpController.java b/src/main/java/com/bapMate/bapMateServer/domain/meeting/controller/MeetUpController.java index df69256..3c72fb8 100644 --- a/src/main/java/com/bapMate/bapMateServer/domain/meeting/controller/MeetUpController.java +++ b/src/main/java/com/bapMate/bapMateServer/domain/meeting/controller/MeetUpController.java @@ -35,11 +35,11 @@ public class MeetUpController { private final AuthentiatedUserUtils authentiatedUserUtils; @Operation(description = "모임 대표 이미지") - @PostMapping(value = "/image/{meetUpId}", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) - public SuccessResponse uploadImage(@PathVariable Long meetUpId,@RequestParam("file") MultipartFile file) throws IOException { + @PostMapping(value = "/image", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) + public SuccessResponse uploadImage(@RequestParam("file") MultipartFile file) throws IOException { try { - meetUpService.uploadImage(meetUpId, file); - SuccessResponse successResponse = SuccessResponse.onSuccess(200); + String imageUrl = meetUpService.uploadImage(file); + SuccessResponse successResponse = SuccessResponse.onSuccess(200,imageUrl); return successResponse; } catch (IOException e) { throw new IllegalArgumentException("오류"); diff --git a/src/main/java/com/bapMate/bapMateServer/domain/meeting/service/MeetUpService.java b/src/main/java/com/bapMate/bapMateServer/domain/meeting/service/MeetUpService.java index 1bfcb2d..7bf9956 100644 --- a/src/main/java/com/bapMate/bapMateServer/domain/meeting/service/MeetUpService.java +++ b/src/main/java/com/bapMate/bapMateServer/domain/meeting/service/MeetUpService.java @@ -32,14 +32,15 @@ public class MeetUpService { private final ParticipationService participationService; private final S3Service s3UploadService; - @Transactional - public void uploadImage(Long meetUpId, MultipartFile file) throws IOException { + //@Transactional + public String uploadImage(MultipartFile file) throws IOException { // S3에 이미지 파일 업로드 및 업로드된 파일의 URL 생성 String imageUrl = s3UploadService.upload(file); - MeetUp meetUp = meetUpRepository.findById(meetUpId).orElseThrow(UserNotFoundException::new); - - meetUp.updateImgUrl(imageUrl); - meetUpRepository.save(meetUp); +// MeetUp meetUp = meetUpRepository.findById(meetUpId).orElseThrow(UserNotFoundException::new); +// +// meetUp.updateImgUrl(imageUrl); +// meetUpRepository.save(meetUp); + return imageUrl; } public MeetUp uploadMeetUp(User user, MeetUpRequestDto requestDto) {