From ca100e87caeb32512c60e198506eb234b7ab49e6 Mon Sep 17 00:00:00 2001 From: Khyojun Date: Thu, 1 Aug 2024 23:27:43 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20:=20reqeustBody=20=EB=B0=A9=EC=8B=9D?= =?UTF-8?q?=EC=9D=84=20requestParam=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mdt/backend/controller/FileSearchController.java | 4 +++- src/main/java/com/mdt/backend/dto/FileSearchRequestDto.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/mdt/backend/controller/FileSearchController.java b/src/main/java/com/mdt/backend/controller/FileSearchController.java index d06c9e5..6cbe0b7 100644 --- a/src/main/java/com/mdt/backend/controller/FileSearchController.java +++ b/src/main/java/com/mdt/backend/controller/FileSearchController.java @@ -10,8 +10,10 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @Tag(name = "SEARCH_API", description = "해당 파일경로가 있는지 확인하기 위한 검색 API") @@ -27,7 +29,7 @@ public class FileSearchController { + "파일 경로에 대한 입력을 하였을 경우 유사한 파일 경로에 대한 결과물을 제공합니다.") @Parameter(name = "filePath", description = "파일 경로에 관한 정보를 입력. 입력하지 않으면 전체 파일 경로를 반환") @GetMapping("/search") - public ResponseEntity searchFiles(@RequestBody(required = false) FileSearchRequestDto fileSearchRequestDto) { + public ResponseEntity searchFiles(@ModelAttribute FileSearchRequestDto fileSearchRequestDto) { List searchedFiles = dbService.searchFiles(fileSearchRequestDto); return ResponseEntity.ok(new FileSearchResponseDto("파일 검색 성공", searchedFiles)); } diff --git a/src/main/java/com/mdt/backend/dto/FileSearchRequestDto.java b/src/main/java/com/mdt/backend/dto/FileSearchRequestDto.java index c5e0e07..70e0d92 100644 --- a/src/main/java/com/mdt/backend/dto/FileSearchRequestDto.java +++ b/src/main/java/com/mdt/backend/dto/FileSearchRequestDto.java @@ -2,8 +2,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; +import lombok.Setter; @Getter +@Setter @NoArgsConstructor public class FileSearchRequestDto { private String fileName;