-
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
#43 [feat] S3 모듈 구현 - presignedUrl
- Loading branch information
Showing
6 changed files
with
50 additions
and
33 deletions.
There are no files selected for viewing
31 changes: 0 additions & 31 deletions
31
module-api/src/main/java/com/mile/controller/TestController.java
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
module-api/src/main/java/com/mile/controller/external/S3Controller.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,24 @@ | ||
package com.mile.controller.external; | ||
|
||
import com.mile.aws.utils.PreSignedUrlResponse; | ||
import com.mile.aws.utils.S3BucketDirectory; | ||
import com.mile.aws.utils.S3Service; | ||
import com.mile.dto.SuccessResponse; | ||
import com.mile.exception.message.SuccessMessage; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
@RequiredArgsConstructor | ||
public class S3Controller implements S3ControllerSwagger { | ||
private final S3Service s3Service; | ||
|
||
@GetMapping("/image/upload") | ||
@Override | ||
public SuccessResponse<PreSignedUrlResponse> getPreSignedUrl() { | ||
return SuccessResponse.of(SuccessMessage.PRESIGNED_URL_GET_SUCCESS, s3Service.getUploadPreSignedUrl(S3BucketDirectory.POST_PREFIX)); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
module-api/src/main/java/com/mile/controller/external/S3ControllerSwagger.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,21 @@ | ||
package com.mile.controller.external; | ||
|
||
import com.mile.aws.utils.PreSignedUrlResponse; | ||
import com.mile.dto.SuccessResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "Image - PreSigned Url", description = "이미지 업로드 할 Url 받기") | ||
public interface S3ControllerSwagger { | ||
|
||
@Operation(summary = "이미지 업로드 presigned url") | ||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "이미지를 업로드할 url이 발행되었습니다."), | ||
@ApiResponse(responseCode = "500", description = "S3 PRESIGNED URL을 받아오기에 실패했습니다.") | ||
} | ||
) | ||
SuccessResponse<PreSignedUrlResponse> getPreSignedUrl(); | ||
} |
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