File tree Expand file tree Collapse file tree
src/main/java/project/flipnote/image Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,9 +24,8 @@ public class ImageUploadController {
2424 //파일 업로드 API
2525 @ PostMapping ("/upload" )
2626 public ResponseEntity <ImageUploadResponseDto > getPresignedUrl (
27- @ AuthenticationPrincipal AuthPrinciple authPrinciple ,
2827 @ RequestBody @ Valid ImageUploadRequestDto req ) {
29- ImageUploadResponseDto res = fileService .getPresignedUrl (authPrinciple , req .fileName ());
28+ ImageUploadResponseDto res = fileService .getPresignedUrl (req .fileName ());
3029 return ResponseEntity .ok (res );
3130 }
3231}
Original file line number Diff line number Diff line change @@ -32,16 +32,8 @@ public class ImageUploadService {
3232
3333 private final S3Client s3Client ;
3434 private final S3Presigner s3Presigner ;
35- private final UserProfileRepository userRepository ;
3635 private static final int EXPIRE_MINUTES = 5 ;
3736
38- //유저 찾기
39- private void findUser (AuthPrinciple authPrinciple ) {
40- userRepository .findByIdAndStatus (authPrinciple .userId (), UserStatus .ACTIVE ).orElseThrow (
41- () -> new BizException (UserErrorCode .USER_NOT_FOUND )
42- );
43- }
44-
4537 //확장자 형식 찾기
4638 private String getContentType (String fileName ) {
4739 String extension = fileName .substring (fileName .lastIndexOf ('.' ) + 1 ).toLowerCase ();
@@ -56,10 +48,7 @@ private String getContentType(String fileName) {
5648 }
5749
5850 // presigned URL 생성
59- public ImageUploadResponseDto getPresignedUrl (AuthPrinciple authPrinciple , String fileName ) {
60-
61- // 유저 찾기
62- findUser (authPrinciple );
51+ public ImageUploadResponseDto getPresignedUrl (String fileName ) {
6352
6453 // S3에 동일한 파일명이 이미 존재하는지 확인
6554 if (objectExists (fileName )) {
You can’t perform that action at this time.
0 commit comments