Skip to content

Commit

Permalink
[feat] 파일 생성 api swagger multipart/form-data 형식 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
chahyunsoo committed Aug 22, 2024
1 parent d4bcb7c commit 597a405
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
Expand Down Expand Up @@ -79,11 +81,13 @@ public ResponseEntity<ApiResponse<?>> createDataPost(@Parameter(hidden = true) @
return ApiResponse.success(postManageService.createDataPost(userId, subCategory, postCreateRequest));
}

@PostMapping("/{boardCode}/files")
@PostMapping(value = "/{boardCode}/files", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ApiResponse<?>> createBoardPostFile(@Parameter(hidden = true) @UserId Long userId,
@PathVariable(name = "boardCode") String boardCode,
@RequestPart(value = "files") MultipartFile[] files,
@RequestParam(value = "type") String typeName) {

return ApiResponse.success(postManageService.createBoardPostFile(userId, boardCode, files, typeName));
}

Expand Down

0 comments on commit 597a405

Please sign in to comment.