-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/issue-588
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
backend/src/main/java/com/funeat/common/controller/PreSingedApiController.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,28 @@ | ||
package com.funeat.common.controller; | ||
|
||
import com.funeat.common.dto.S3UrlRequest; | ||
import com.funeat.common.dto.S3UrlResponse; | ||
import com.funeat.common.s3.S3UploadUrlGenerator; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class PreSingedApiController implements PreSingedController { | ||
|
||
private final S3UploadUrlGenerator s3UploadUrlGenerator; | ||
|
||
public PreSingedApiController(final S3UploadUrlGenerator s3UploadUrlGenerator) { | ||
this.s3UploadUrlGenerator = s3UploadUrlGenerator; | ||
} | ||
|
||
@PostMapping("/api/s3/presigned") | ||
public ResponseEntity<S3UrlResponse> getPreSingedUrl(@RequestBody final S3UrlRequest request) { | ||
final S3UrlResponse preSignedUrl = s3UploadUrlGenerator.getPreSignedUrl(request.getFileName()); | ||
|
||
return ResponseEntity.status(HttpStatus.CREATED) | ||
.body(preSignedUrl); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/com/funeat/common/controller/PreSingedController.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,20 @@ | ||
package com.funeat.common.controller; | ||
|
||
import com.funeat.common.dto.S3UrlRequest; | ||
import com.funeat.common.dto.S3UrlResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
public interface PreSingedController { | ||
|
||
@Operation(summary = "S3 업로드 URL 요청", description = "S3 업로드 URL 요청한다.") | ||
@ApiResponse( | ||
responseCode = "201", | ||
description = "업로드 URL 요청 성공." | ||
) | ||
@PostMapping | ||
ResponseEntity<S3UrlResponse> getPreSingedUrl(@RequestBody final S3UrlRequest request); | ||
} |