Skip to content

Commit

Permalink
리뷰 상세데이터를 포함한 오점완 달력 데이터 응답 기능 개선 완료 (#196)
Browse files Browse the repository at this point in the history
* Refactor: 응답에 reviewId를 추가하기 위한 쿼리 개선 (#194)

* Refactor: 응답에 reviewId를 추가하기 위한 매핑 정보 개선 (#194)

* Refactor: 응답에 reviewId를 추가하기 위한 매핑 오브젝트 개선 (#194)

* Refactor: 응답에 reviewId를 추가하기 위한 응답 오브젝트 개선 (#194)
  • Loading branch information
hyunsb authored Oct 2, 2023
1 parent b473624 commit 0197b0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/com/livable/server/entity/Review.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
classes = @ConstructorResult(
targetClass = Projection.AllReviewDetailDTO.class,
columns = {
@ColumnResult(name = "reviewId", type = Long.class),
@ColumnResult(name = "reviewTitle", type = String.class),
@ColumnResult(name = "reviewTaste", type = String.class),
@ColumnResult(name = "reviewDescription", type = String.class),
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/livable/server/review/dto/Projection.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static class RestaurantReviewList {
@AllArgsConstructor
public static class AllReviewDetailDTO {

private Long reviewId;
private String reviewTitle;
private Evaluation reviewTaste;
private String reviewDescription;
Expand All @@ -63,8 +64,9 @@ public static class AllReviewDetailDTO {
private String images;
private String reviewType;

public AllReviewDetailDTO(String reviewTitle, String reviewTaste, String reviewDescription, String reviewCreatedAt, String location, String images, String reviewType) {
public AllReviewDetailDTO(Long reviewId, String reviewTitle, String reviewTaste, String reviewDescription, String reviewCreatedAt, String location, String images, String reviewType) {

this.reviewId = reviewId;
this.reviewTitle = reviewTitle;
this.reviewTaste = Objects.isNull(reviewTaste) ? null : Evaluation.valueOf(reviewTaste);
this.reviewDescription = reviewDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public CalendarListDTO(Long reviewId, String type, String reviewImageUrl, LocalD
@Builder
public static class DetailListDTO {

private Long reviewId;
private String reviewTitle;
private Evaluation reviewTaste;
private String reviewDescription;
Expand All @@ -39,6 +40,7 @@ public static class DetailListDTO {

public static DetailListDTO valueOf(Projection.AllReviewDetailDTO detailDTO, ImageSeparator imageSeparator) {
return DetailListDTO.builder()
.reviewId(detailDTO.getReviewId())
.reviewTitle(detailDTO.getReviewTitle())
.reviewTaste(detailDTO.getReviewTaste())
.reviewDescription(detailDTO.getReviewDescription())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class ReviewProjectionRepository {
FIND_ALL_REVIEW_DETAIL_BETWEEN_DATE_QUERY = "SELECT * " +
"FROM (" +
"SELECT " +
"review.id as reviewId, " +
"review.selected_dishes as reviewTitle, " +
"restaurant_review.taste as reviewTaste, " +
"review.description as reviewDescription, " +
Expand All @@ -77,6 +78,7 @@ public class ReviewProjectionRepository {
"GROUP BY review.id, review.member_id " +
"UNION " +
"SELECT " +
"review.id as reviewId, " +
"review.selected_dishes as reviewTitle, " +
"cafeteria_review.taste as reviewTaste, " +
"review.description as reviewDescription, " +
Expand All @@ -92,6 +94,7 @@ public class ReviewProjectionRepository {
"GROUP BY review.id, review.member_id " +
"UNION " +
"SELECT " +
"review.id as reviewId, " +
"review.selected_dishes as reviewTitle, " +
"NULL as reviewTaste, " +
"review.description as reviewDescription, " +
Expand Down

0 comments on commit 0197b0f

Please sign in to comment.