Skip to content

Commit

Permalink
Merge branch 'develop' into feat/issue-588
Browse files Browse the repository at this point in the history
  • Loading branch information
wugawuga authored Sep 11, 2023
2 parents 2813249 + 677f1b3 commit d196b52
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
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);
}
}
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);
}

0 comments on commit d196b52

Please sign in to comment.