Skip to content
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 @@ -17,6 +17,8 @@
public class GuesthouseDetailDTO {
private Long id;
private String name;
private Long reviewCount;
private Double averageScore;
private String addressRegion;
private String addressDetail;
private String information;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ public GuesthouseDetailDTO getHouseById(Long guesthouseId) {
return GuesthouseDetailDTO.builder()
.id(gh.getId())
.name(gh.getName())
.reviewCount(Long.valueOf(reviewRepository.countByGuesthouseId(gh.getId())))
.averageScore(
Optional.ofNullable(
reviewRepository.findAverageScoreByGuesthouseId(gh.getId())
).orElse(0.0)
)
.addressRegion(gh.getAddressRegion())
.addressDetail(gh.getAddressDetail())
.information(gh.getInformation())
Expand Down