diff --git a/src/main/java/com/example/locavel/web/controller/ReviewRestController.java b/src/main/java/com/example/locavel/web/controller/ReviewRestController.java index 861f69a..699c251 100644 --- a/src/main/java/com/example/locavel/web/controller/ReviewRestController.java +++ b/src/main/java/com/example/locavel/web/controller/ReviewRestController.java @@ -36,8 +36,9 @@ public class ReviewRestController { @PostMapping(value = "/{placeId}", consumes = "multipart/form-data") public ApiResponse createReview( HttpServletRequest httpServletRequest, - @ModelAttribute ReviewRequestDTO.ReviewDTO request, - @PathVariable(name="placeId") Long placeId) { + @Valid @RequestPart ReviewRequestDTO.ReviewDTO request, + @PathVariable(name="placeId") Long placeId, + @RequestPart(required = false) List reviewImgUrls) { if(request.getRating() == null) { throw new ReviewsHandler(ErrorStatus.RATING_NOT_EXIST); } @@ -48,7 +49,7 @@ public ApiResponse createReview( User user = userCommandService.getUser(httpServletRequest); Long userId = user.getId(); userCommandService.calculateTravelerGradeScore(userId ,request); //여행객 점수를 증가시키는 로직 - ReviewResponseDTO.ReviewResultDTO response = reviewService.createReview(user, placeId, request, request.getImg()); + ReviewResponseDTO.ReviewResultDTO response = reviewService.createReview(user, placeId, request, reviewImgUrls); return ApiResponse.of(SuccessStatus.REVIEW_CREATE_OK,response); } diff --git a/src/main/java/com/example/locavel/web/dto/ReviewDTO/ReviewRequestDTO.java b/src/main/java/com/example/locavel/web/dto/ReviewDTO/ReviewRequestDTO.java index 83275e3..60567bc 100644 --- a/src/main/java/com/example/locavel/web/dto/ReviewDTO/ReviewRequestDTO.java +++ b/src/main/java/com/example/locavel/web/dto/ReviewDTO/ReviewRequestDTO.java @@ -3,10 +3,6 @@ import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; -import org.springframework.web.multipart.MultipartFile; - -import java.util.List; - public class ReviewRequestDTO { @Getter @Setter @@ -14,6 +10,5 @@ public static class ReviewDTO { String comment; @NotNull Float rating; - List img; } }