11package inha .gdgoc .domain .resource .controller ;
22
3+ import io .swagger .v3 .oas .annotations .Operation ;
34import inha .gdgoc .domain .resource .enums .S3KeyType ;
45import inha .gdgoc .domain .resource .service .S3Service ;
56import inha .gdgoc .global .dto .response .ApiResponse ;
67import lombok .RequiredArgsConstructor ;
8+ import org .springframework .http .MediaType ;
79import org .springframework .http .ResponseEntity ;
810import org .springframework .web .bind .annotation .PostMapping ;
911import org .springframework .web .bind .annotation .RequestMapping ;
10- import org .springframework .web .bind .annotation .RequestParam ;
12+ import org .springframework .web .bind .annotation .RequestPart ;
1113import org .springframework .web .bind .annotation .RestController ;
1214import org .springframework .web .multipart .MultipartFile ;
1315
@@ -20,9 +22,10 @@ public class FileUploadController {
2022
2123 private record UploadResponse (String url ) {}
2224
23- @ PostMapping
25+ @ PostMapping (consumes = MediaType .MULTIPART_FORM_DATA_VALUE )
26+ @ Operation (summary = "파일 업로드" , description = "multipart/form-data로 파일 업로드 후 S3 URL 반환" )
2427 public ResponseEntity <ApiResponse <UploadResponse , Void >> upload (
25- @ RequestParam ("file" ) MultipartFile file
28+ @ RequestPart ("file" ) MultipartFile file
2629 ) throws Exception {
2730 String key = s3Service .upload (0L , S3KeyType .study , file );
2831 String url = s3Service .getS3FileUrl (key );
0 commit comments