1010import io .swagger .v3 .oas .annotations .Parameter ;
1111import io .swagger .v3 .oas .annotations .media .Content ;
1212import io .swagger .v3 .oas .annotations .tags .Tag ;
13+ import jakarta .validation .constraints .NotNull ;
1314import lombok .RequiredArgsConstructor ;
1415import org .springframework .http .MediaType ;
1516import org .springframework .http .ResponseEntity ;
1819import org .springframework .web .bind .annotation .PostMapping ;
1920import org .springframework .web .bind .annotation .RequestMapping ;
2021import org .springframework .web .bind .annotation .RequestParam ;
22+ import org .springframework .web .bind .annotation .RequestPart ;
2123import org .springframework .web .multipart .MultipartFile ;
2224
2325import java .io .IOException ;
@@ -30,12 +32,12 @@ public class RegisterMemberCsvController {
3032 private final RegisterMemberCSVUsecase registerMemberCSVUsecase ;
3133
3234 @ Operation (summary = "CSV 파일로 회원 등록 API" )
33- @ PostMapping ("/members/upload" )
35+ @ PostMapping (value = "/members/upload" , consumes = { MediaType . MULTIPART_FORM_DATA_VALUE } )
3436 @ Secured ("ROLE_ADMIN" )
3537 public ResponseEntity <String > registerMembersFromCsv (
3638 @ AuthenticationPrincipal SecurityUserDetails userInfo ,
37- @ Parameter (description = "csv, 엑셀 포맷 파일만 입력 가능합니다." , content = @ Content (mediaType = MediaType .MULTIPART_FORM_DATA_VALUE ))
38- @ RequestParam ("file" ) MultipartFile file ) throws IOException {
39+ @ Parameter (content = @ Content (mediaType = MediaType .MULTIPART_FORM_DATA_VALUE ))
40+ @ RequestParam ("file" ) @ NotNull MultipartFile file ) throws IOException {
3941 if (!FileTypeValidator .validCSVFile (file .getInputStream ())) {
4042 throw new AdapterException (FileErrorcode .UNSUPPORTED_FILE_TYPE );}
4143 int addedCount = registerMemberCSVUsecase .registerMembersFromCsv (userInfo .getUserId (), file );
0 commit comments