Skip to content

Commit 5236106

Browse files
committed
[feat] S3 Swagger 스펙 작성
1 parent 85d442d commit 5236106

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.example.muneoserver.domain.file.controller.docs;
2+
3+
import com.example.muneoserver.domain.file.dto.PresignedUrlResponse;
4+
import com.example.muneoserver.global.dto.ApiResponse;
5+
import com.example.muneoserver.global.security.auth.AuthUser;
6+
import io.swagger.v3.oas.annotations.Operation;
7+
import io.swagger.v3.oas.annotations.Parameter;
8+
import io.swagger.v3.oas.annotations.media.Content;
9+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
10+
import io.swagger.v3.oas.annotations.tags.Tag;
11+
import org.springframework.http.ResponseEntity;
12+
13+
@Tag(name = "Files", description = "파일 업로드 관련 API")
14+
public interface FileControllerDocs {
15+
16+
@Operation(
17+
summary = "S3 Presigned URL 발급",
18+
description = "업로드 타입, 원본 파일명, Content-Type을 받아 S3 PUT 업로드용 Presigned URL을 발급합니다. "
19+
+ "업로드 요청 시에는 응답의 contentType 값을 그대로 Content-Type 헤더에 담아 PUT 요청을 보내야 합니다."
20+
)
21+
@ApiResponses(value = {
22+
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "Presigned URL 발급 성공"),
23+
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "잘못된 요청 값", content = @Content),
24+
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "401", description = "인증 필요", content = @Content),
25+
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "S3 설정 오류 또는 Presigned URL 생성 실패", content = @Content)
26+
})
27+
ResponseEntity<ApiResponse<PresignedUrlResponse>> issuePresignedUrl(
28+
@Parameter(hidden = true) AuthUser authUser,
29+
@Parameter(
30+
description = "업로드 타입. Estimate는 견적서, Post는 이미지를 의미합니다.",
31+
example = "Post"
32+
) String type,
33+
@Parameter(
34+
description = "원본 파일명. 마지막 확장자를 기준으로 S3 object key에 동일한 확장자가 보존됩니다.",
35+
example = "room.jpg"
36+
) String filename,
37+
@Parameter(
38+
description = "업로드 파일의 MIME 타입. 이후 S3 PUT 요청의 Content-Type 헤더에도 같은 값을 사용해야 합니다.",
39+
example = "image/jpeg"
40+
) String contentType
41+
);
42+
}

0 commit comments

Comments
 (0)