Skip to content

Commit

Permalink
Merge pull request #90 from locavell/fix/#89
Browse files Browse the repository at this point in the history
[#89] 리뷰 등록 controller 수정
  • Loading branch information
KkomSang authored Aug 22, 2024
2 parents d53b3df + 0537b14 commit d0446d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class ReviewRestController {
@PostMapping(value = "/{placeId}", consumes = "multipart/form-data")
public ApiResponse<ReviewResponseDTO.ReviewResultDTO> 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<MultipartFile> reviewImgUrls) {
if(request.getRating() == null) {
throw new ReviewsHandler(ErrorStatus.RATING_NOT_EXIST);
}
Expand All @@ -48,7 +49,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, request.getImg());
ReviewResponseDTO.ReviewResultDTO response = reviewService.createReview(user, placeId, request, reviewImgUrls);
return ApiResponse.of(SuccessStatus.REVIEW_CREATE_OK,response);
}

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

0 comments on commit d0446d7

Please sign in to comment.