diff --git a/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoPreview.java b/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoPreview.java index cd946c73..46a7a22c 100644 --- a/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoPreview.java +++ b/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoPreview.java @@ -19,6 +19,8 @@ public class PlaceInfoPreview { private String roadAddress; private String activeTime; private Double rating; + private Double placeLatitude; + private Double placeLongitude; private Long reviewCount; private boolean isLiked; } diff --git a/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java b/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java index 2ff0aea1..8b67546b 100644 --- a/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java +++ b/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java @@ -64,6 +64,10 @@ public class PlaceCourseService { private final PlaceCourseRepository placeCourseRepository; public CompletableFuture getPlacesByLocation(String searchKeyword, Double latitude, Double longitude, Integer page) { + Long memberId = SecurityUtil.getCurrentMemberId(); + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new GeneralException(ErrorStatus.MEMBER_NOT_FOUND)); + return CompletableFuture.supplyAsync(() -> getSearchResponse(searchKeyword, latitude, longitude, page)) .thenApply(response -> { try { @@ -83,7 +87,8 @@ public CompletableFuture getPlacesByLocation(String se Optional place = placeRepository.findByPoiId(poiId); if (place.isPresent()) { Long reviewCount = placeReviewRepository.countByPlaceId(place.get().getId()); - return PlaceConverter.toPlaceInfoPreview(place.get(), reviewCount); + Boolean isLiked = placeLikeRepository.findByPlaceAndMember(place.get(), member).isPresent(); + return PlaceConverter.toPlaceInfoPreview(place.get(), reviewCount, isLiked); } else { return createPlace(poiId); } @@ -219,7 +224,7 @@ private PlaceInfoPreview createPlace(Long poiId) { placeRepository.save(place); - return PlaceConverter.toPlaceInfoPreview(place, 0L); + return PlaceConverter.toPlaceInfoPreview(place, 0L, false); } private Map getPlaceInfo(Long poiId) { diff --git a/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java b/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java index 823e1e97..cfbe92b2 100644 --- a/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java +++ b/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java @@ -28,7 +28,7 @@ public static CourseInfoResponse.getPlaceInfoOfCourseDTO toPlaceInfoOfCourseDTO( .build(); } - public static PlaceInfoPreview toPlaceInfoPreview(Place place, Long reviewCount) { + public static PlaceInfoPreview toPlaceInfoPreview(Place place, Long reviewCount, Boolean isLiked) { String categoryName = null; Double rating = 0.0; @@ -49,6 +49,8 @@ public static PlaceInfoPreview toPlaceInfoPreview(Place place, Long reviewCount) .activeTime(place.getActiveTime()) .rating(rating) .reviewCount(reviewCount) + .placeLatitude(place.getLatitude()) + .placeLongitude(place.getLongitude()) .build(); }