Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 리뷰 등록 controller 수정 #88

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}