Skip to content

Commit

Permalink
Merge pull request #85 from locavell/fix/#84
Browse files Browse the repository at this point in the history
[#84] 리뷰 등록 controller 수정
  • Loading branch information
KkomSang authored Aug 22, 2024
2 parents 9828a9e + c0109da commit edd0af0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ public class ReviewRestController {
@PostMapping(value = "/{placeId}", consumes = "multipart/form-data")
public ApiResponse<ReviewResponseDTO.ReviewResultDTO> createReview(
HttpServletRequest httpServletRequest,
@Valid @RequestPart ReviewRequestDTO.ReviewDTO request,
@PathVariable(name="placeId") Long placeId,
@RequestPart(required = false) List<MultipartFile> reviewImgUrls) {
@ModelAttribute ReviewRequestDTO.ReviewDTO request,
@PathVariable(name="placeId") Long placeId) {
if(request.getRating() == null) {
throw new ReviewsHandler(ErrorStatus.RATING_NOT_EXIST);
}
Expand All @@ -49,7 +48,7 @@ public ApiResponse<ReviewResponseDTO.ReviewResultDTO> createReview(
User user = userCommandService.getUser(httpServletRequest);
Long userId = user.getId();
userCommandService.calculateTravelerGradeScore(userId ,request); //여행객 점수를 증가시키는 로직
ReviewResponseDTO.ReviewResultDTO response = reviewService.createReview(user, placeId, request, reviewImgUrls);
ReviewResponseDTO.ReviewResultDTO response = reviewService.createReview(user, placeId, request, request.getImg());
return ApiResponse.of(SuccessStatus.REVIEW_CREATE_OK,response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
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
Expand All @@ -11,5 +14,6 @@ public static class ReviewDTO {
String comment;
@NotNull
Float rating;
List<MultipartFile> img;
}
}

0 comments on commit edd0af0

Please sign in to comment.