-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
18 deletions.
There are no files selected for viewing
37 changes: 19 additions & 18 deletions
37
src/main/java/team7/inplace/review/application/dto/MyReviewInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
); | ||
} | ||
} |