Skip to content

Commit

Permalink
Merge pull request #13 from BapMate/fix/login
Browse files Browse the repository at this point in the history
fix: login redirect url변경
  • Loading branch information
AlmondBreez3 authored Nov 18, 2023
2 parents bf19a37 + 1b22f03 commit 29d1281
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> 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<Object> uploadImage(@RequestParam("file") MultipartFile file) throws IOException {
try {
meetUpService.uploadImage(meetUpId, file);
SuccessResponse<Object> successResponse = SuccessResponse.onSuccess(200);
String imageUrl = meetUpService.uploadImage(file);
SuccessResponse<Object> successResponse = SuccessResponse.onSuccess(200,imageUrl);
return successResponse;
} catch (IOException e) {
throw new IllegalArgumentException("오류");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 29d1281

Please sign in to comment.