Skip to content

Commit

Permalink
[refactor] 작성한 리뷰 반환에 placeName 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wndlthsk committed Nov 14, 2024
1 parent 44e2dc3 commit 27f38c3
Showing 1 changed file with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
package team7.inplace.review.application.dto;

import java.util.Date;
import team7.inplace.place.application.dto.PlaceInfo.AddressInfo;
import team7.inplace.place.domain.Place;
import team7.inplace.review.domain.Review;

import java.util.Date;


public record MyReviewInfo(
Long reviewId,
boolean likes,
String comment,
Date createdDate,
ReviewPlaceInfo placeInfo
Long reviewId,
boolean likes,
String comment,
Date createdDate,
ReviewPlaceInfo placeInfo
) {

public record ReviewPlaceInfo(
Long placeId,
String imgUrl,
AddressInfo address
Long placeId,
String placeName,
String imgUrl,
AddressInfo address
) {

public static ReviewPlaceInfo from(Place place) {
return new ReviewPlaceInfo(
place.getId(),
place.getMenuImgUrl(),
AddressInfo.of(place.getAddress())
place.getId(),
place.getName(),
place.getMenuImgUrl(),
AddressInfo.of(place.getAddress())
);
}
}

public static MyReviewInfo from(Review review) {
return new MyReviewInfo(
review.getId(),
review.isLiked(),
review.getComment(),
review.getCreatedDate(),
ReviewPlaceInfo.from(review.getPlace())
review.getId(),
review.isLiked(),
review.getComment(),
review.getCreatedDate(),
ReviewPlaceInfo.from(review.getPlace())
);
}
}

0 comments on commit 27f38c3

Please sign in to comment.