-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] 회원 프로필 수정 API에서 MultipartFile 제거
- Loading branch information
Showing
17 changed files
with
489 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/jeju/nanaland/domain/member/service/ProfileImageService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.jeju.nanaland.domain.member.service; | ||
|
||
import static com.jeju.nanaland.global.exception.ErrorCode.MEMBER_NOT_FOUND; | ||
|
||
import com.jeju.nanaland.domain.common.entity.ImageFile; | ||
import com.jeju.nanaland.domain.member.entity.Member; | ||
import com.jeju.nanaland.domain.member.repository.MemberRepository; | ||
import com.jeju.nanaland.global.exception.NotFoundException; | ||
import com.jeju.nanaland.global.image_upload.dto.S3ImageDto; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class ProfileImageService { | ||
|
||
private final MemberRepository memberRepository; | ||
|
||
@Transactional | ||
public void updateMemberProfileImage(Long memberId, S3ImageDto s3ImageDto) { | ||
Member member = memberRepository.findById(memberId) | ||
.orElseThrow(() -> new NotFoundException(MEMBER_NOT_FOUND.getMessage())); | ||
ImageFile originImageFile = member.getProfileImageFile(); | ||
originImageFile.updateImageFile(s3ImageDto.getOriginUrl(), s3ImageDto.getThumbnailUrl()); | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
...analand/global/image_upload/S3Config.java → ...jeju/nanaland/global/config/S3Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/com/jeju/nanaland/global/file/controller/FileUploadController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.jeju.nanaland.global.file.controller; | ||
|
||
import static com.jeju.nanaland.global.exception.SuccessCode.COMPLETE_PRESIGNED_URL_SUCCESS; | ||
import static com.jeju.nanaland.global.exception.SuccessCode.GET_PRESIGNED_URL_SUCCESS; | ||
|
||
import com.jeju.nanaland.global.BaseResponse; | ||
import com.jeju.nanaland.global.file.dto.FileRequest; | ||
import com.jeju.nanaland.global.file.dto.FileResponse; | ||
import com.jeju.nanaland.global.file.service.FileUploadService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/file") | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
@Tag(name = "파일(File)", description = "파일(File) API입니다.") | ||
public class FileUploadController { | ||
|
||
private final FileUploadService fileUploadService; | ||
|
||
@Operation(summary = "Pre-Signed URL 업로드 시작 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "400", description = "올바르지 않은 요청인 경우", content = @Content), | ||
@ApiResponse(responseCode = "500", description = "서버측 에러", content = @Content) | ||
}) | ||
@PostMapping("/upload-init") | ||
public BaseResponse<FileResponse.InitResultDto> uploadInit( | ||
@RequestBody @Valid FileRequest.InitCommandDto initCommandDto | ||
){ | ||
FileResponse.InitResultDto initResultDto = fileUploadService.uploadInit(initCommandDto); | ||
return BaseResponse.success(GET_PRESIGNED_URL_SUCCESS, initResultDto); | ||
} | ||
|
||
@Operation(summary = "Pre-Signed URL 업로드 완료 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "500", description = "서버측 에러", content = @Content) | ||
}) | ||
@PostMapping("/upload-complete") | ||
public BaseResponse<Void> uploadComplete( | ||
@RequestBody @Valid FileRequest.CompleteCommandDto completeCommandDto | ||
) { | ||
fileUploadService.uploadComplete(completeCommandDto); | ||
return BaseResponse.success(COMPLETE_PRESIGNED_URL_SUCCESS); | ||
} | ||
} |
Oops, something went wrong.