Skip to content

Commit

Permalink
refactor(File): MultipartFile을 올바르게 전달받도록 변경(RequestParam->RequestBody)
Browse files Browse the repository at this point in the history
  • Loading branch information
limehee committed Aug 7, 2024
1 parent ed08ac3 commit 43167a9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class FileController {
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_SUPER" })
@PostMapping(value = "/boards", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponse<List<UploadedFileResponseDto>> boardUpload(
@RequestParam(name = "multipartFile") List<MultipartFile> multipartFiles,
@RequestBody List<MultipartFile> multipartFiles,
@RequestParam(name = "storagePeriod") long storagePeriod
) throws IOException, PermissionDeniedException {
List<UploadedFileResponseDto> responseDtos = fileService.saveFiles(multipartFiles, "boards", storagePeriod);
Expand All @@ -46,7 +46,7 @@ public ApiResponse<List<UploadedFileResponseDto>> boardUpload(
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_SUPER" })
@PostMapping(value = "/profiles", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponse<UploadedFileResponseDto> profileUpload(
@RequestParam(name = "multipartFile") MultipartFile multipartFile,
@RequestBody MultipartFile multipartFile,
@RequestParam(name = "storagePeriod") long storagePeriod
) throws IOException, PermissionDeniedException {
UploadedFileResponseDto responseDto = fileService.saveFile(multipartFile, fileService.buildPath("profiles"), storagePeriod);
Expand All @@ -57,7 +57,7 @@ public ApiResponse<UploadedFileResponseDto> profileUpload(
@Secured({ "ROLE_ADMIN", "ROLE_SUPER" })
@PostMapping(value = "/activity-photos", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponse<List<UploadedFileResponseDto>> activityUpload(
@RequestParam(name = "multipartFile") List<MultipartFile> multipartFiles,
@RequestBody List<MultipartFile> multipartFiles,
@RequestParam(name = "storagePeriod") long storagePeriod
) throws IOException, PermissionDeniedException {
List<UploadedFileResponseDto> responseDtos = fileService.saveFiles(multipartFiles, "activity-photos", storagePeriod);
Expand All @@ -68,7 +68,7 @@ public ApiResponse<List<UploadedFileResponseDto>> activityUpload(
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_SUPER" })
@PostMapping(value = "/members", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponse<List<UploadedFileResponseDto>> memberCloudUpload(
@RequestParam(name = "multipartFile") List<MultipartFile> multipartFiles,
@RequestBody List<MultipartFile> multipartFiles,
@RequestParam(name = "storagePeriod") long storagePeriod
) throws IOException, PermissionDeniedException {
List<UploadedFileResponseDto> responseDtos = fileService.saveFiles(multipartFiles, fileService.buildPath("members"), storagePeriod);
Expand All @@ -81,7 +81,7 @@ public ApiResponse<List<UploadedFileResponseDto>> memberCloudUpload(
public ApiResponse<List<UploadedFileResponseDto>> assignmentUpload(
@PathVariable(name = "activityGroupId") Long activityGroupId,
@PathVariable(name = "activityGroupBoardId") Long activityGroupBoardId,
@RequestParam(name = "multipartFile") List<MultipartFile> multipartFiles,
@RequestBody List<MultipartFile> multipartFiles,
@RequestParam(name = "storagePeriod") long storagePeriod
) throws PermissionDeniedException, IOException, NotFoundException {
List<UploadedFileResponseDto> responseDtos = fileService.saveFiles(multipartFiles, fileService.buildPath("assignments", activityGroupId, activityGroupBoardId), storagePeriod);
Expand All @@ -92,7 +92,7 @@ public ApiResponse<List<UploadedFileResponseDto>> assignmentUpload(
@Secured({ "ROLE_USER", "ROLE_ADMIN", "ROLE_SUPER" })
@PostMapping(value = "/membership-fee", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ApiResponse<List<UploadedFileResponseDto>> assignmentUpload(
@RequestParam(name = "multipartFile") List<MultipartFile> multipartFiles,
@RequestBody List<MultipartFile> multipartFiles,
@RequestParam(name = "storagePeriod") long storagePeriod
) throws PermissionDeniedException, IOException, NotFoundException {
List<UploadedFileResponseDto> responseDtos = fileService.saveFiles(multipartFiles, "membership-fees", storagePeriod);
Expand Down

0 comments on commit 43167a9

Please sign in to comment.