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 @@ -2,6 +2,7 @@

import com.wayble.server.explore.dto.facility.WaybleFacilityConditionDto;
import com.wayble.server.explore.dto.facility.WaybleFacilityResponseDto;
//import com.wayble.server.explore.repository.facility.WaybleFacilityQuerySearchMysqlRepository;
import com.wayble.server.explore.repository.facility.WaybleFacilityQuerySearchRepository;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
Expand All @@ -16,6 +17,8 @@ public class WaybleFacilityDocumentService {

private final WaybleFacilityQuerySearchRepository waybleFacilityQuerySearchRepository;

//private final WaybleFacilityQuerySearchMysqlRepository waybleFacilityQuerySearchRepository;

public List<WaybleFacilityResponseDto> findNearbyFacilityDocuments(WaybleFacilityConditionDto dto) {
return waybleFacilityQuerySearchRepository.findNearbyFacilitiesByType(dto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.wayble.server.explore.entity.WaybleZoneDocument;
import com.wayble.server.explore.repository.RecommendLogDocumentRepository;
import com.wayble.server.explore.repository.WaybleZoneDocumentRepository;
//import com.wayble.server.explore.repository.recommend.WaybleZoneQueryRecommendMysqlRepository;
import com.wayble.server.explore.repository.recommend.WaybleZoneQueryRecommendRepository;
import com.wayble.server.common.exception.ApplicationException;
import com.wayble.server.explore.dto.recommend.WaybleZoneRecommendResponseDto;
Expand All @@ -26,6 +27,8 @@ public class WaybleZoneRecommendService {

private final WaybleZoneQueryRecommendRepository waybleZoneRecommendRepository;

//private final WaybleZoneQueryRecommendMysqlRepository waybleZoneRecommendRepository;

private final RecommendLogDocumentRepository recommendLogDocumentRepository;

private final WaybleZoneDocumentRepository waybleZoneDocumentRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wayble.server.explore.service;

import com.wayble.server.explore.dto.search.response.WaybleZoneDistrictResponseDto;
//import com.wayble.server.explore.repository.search.WaybleZoneQuerySearchMysqlRepository;
import com.wayble.server.explore.repository.search.WaybleZoneQuerySearchRepository;
import com.wayble.server.explore.dto.search.request.WaybleZoneSearchConditionDto;
import com.wayble.server.explore.dto.search.response.WaybleZoneSearchResponseDto;
Expand All @@ -18,6 +19,8 @@ public class WaybleZoneSearchService {

private final WaybleZoneQuerySearchRepository waybleZoneQuerySearchRepository;

//private final WaybleZoneQuerySearchMysqlRepository waybleZoneQuerySearchRepository;

private final WaybleZoneRepository waybleZoneRepository;

public Slice<WaybleZoneSearchResponseDto> searchWaybleZonesByCondition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public WaybleZoneDetailResponseDto getWaybleZoneDetail(Long waybleZoneId) {
if (f == null) throw new ApplicationException(WaybleZoneErrorCase.WAYBLE_ZONE_FACILITY_NOT_FOUND);

var images = zone.getWaybleZoneImageList();
String imageUrl = images.stream().findFirst().map(WaybleZoneImage::getImageUrl).orElse(null);
//String imageUrl = images.stream().findFirst().map(WaybleZoneImage::getImageUrl).orElse(null);
List<String> photoUrls = images.stream().map(WaybleZoneImage::getImageUrl).toList();

Comment on lines 71 to 74
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

대표 이미지 null 폴백 및 photos와의 불일치 해소 필요

이번 수정으로 상세의 대표 이미지를 zone.getMainImageUrl()로 일관화한 점은 👍 입니다. 다만 기존 데이터에 mainImageUrl이 비어 있는 경우 상세 화면의 대표 이미지가 사라질 수 있고, 대표 이미지가 waybleZoneImageList에 포함되지 않은 경우 photos와 대표 이미지가 불일치할 수 있습니다. 아래처럼 폴백(첫 번째 이미지)과 photos에 대표 이미지 포함을 보장하는 처리를 제안합니다.

아래 diff는 해당 구간만 교체합니다.

@@
-        var images = zone.getWaybleZoneImageList();
-        //String imageUrl = images.stream().findFirst().map(WaybleZoneImage::getImageUrl).orElse(null);
-        List<String> photoUrls = images.stream().map(WaybleZoneImage::getImageUrl).toList();
+        var images = zone.getWaybleZoneImageList();
+        // 대표 이미지(없으면 첫 이미지로 폴백) + photos에 대표 이미지 포함 보장
+        String mainImageUrl = zone.getMainImageUrl();
+        List<String> photoUrls = images.stream()
+                .map(WaybleZoneImage::getImageUrl)
+                .filter(java.util.Objects::nonNull)
+                .distinct()
+                .collect(java.util.stream.Collectors.toCollection(java.util.ArrayList::new));
+        if (mainImageUrl == null || mainImageUrl.isBlank()) {
+            mainImageUrl = photoUrls.isEmpty() ? null : photoUrls.get(0);
+        } else if (!photoUrls.contains(mainImageUrl)) {
+            photoUrls.add(0, mainImageUrl);
+        }
@@
-                .imageUrl(zone.getMainImageUrl())
+                .imageUrl(mainImageUrl)

추가 import가 필요합니다(파일 상단 import 블록에 추가).

import java.util.ArrayList;
import java.util.Objects;
import java.util.stream.Collectors;

Also applies to: 97-97

🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java
around lines 71-74 (also apply same change at line 97), the code builds
photoUrls directly from zone.getWaybleZoneImageList() and uses
zone.getMainImageUrl() elsewhere, which can lead to a null main image and
mismatches between the representative image and photos; update the logic to (1)
if zone.getMainImageUrl() is null or blank, set it to the first imageUrl from
waybleZoneImageList (fallback), (2) build photoUrls as a modifiable list, ensure
the mainImageUrl is included as the first element (avoid duplicates using
Objects.equals), and (3) import java.util.ArrayList, java.util.Objects, and
java.util.stream.Collectors at the top of the file. Ensure you perform the same
fix at the other occurrence around line 97.

Map<String, WaybleZoneDetailResponseDto.BusinessHourDto> businessHours = new LinkedHashMap<>();
Expand All @@ -94,7 +94,7 @@ public WaybleZoneDetailResponseDto getWaybleZoneDetail(Long waybleZoneId) {
.rating(zone.getRating())
.reviewCount(zone.getReviewCount())
.contactNumber(zone.getContactNumber())
.imageUrl(imageUrl)
.imageUrl(zone.getMainImageUrl())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

목록 API와 대표 이미지 기준의 일관성 점검 요청

상세는 mainImageUrl, 목록은 여전히 "첫 이미지"를 노출합니다(라인 39~49). 사용자 경험 차원에서 동일 기준을 적용할지 결정이 필요합니다. 아래 스크립트로 코드베이스의 대표 이미지 사용 위치를 빠르게 점검해 주세요.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "[1] 목록/상세에서 대표 이미지 사용 위치 확인"
rg -n -C2 'getMainImageUrl\(|imageUrl\(' src/main/java/com/wayble/server/wayblezone | sed -n '1,200p'

echo
echo "[2] 추천/검색 응답 DTO에서 대표 이미지 필드 구성 확인"
rg -n -C2 'WaybleZone(Recommend|Search|List)ResponseDto|mainImageUrl' src/main/java | sed -n '1,200p'

Length of output: 24783


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "===== WaybleZoneListResponseDto ====="
sed -n '1,200p' src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneListResponseDto.java

echo
echo "===== WaybleZoneDetailResponseDto ====="
sed -n '1,200p' src/main/java/com/wayble/server/wayblezone/dto/WaybleZoneDetailResponseDto.java

echo
echo "===== WaybleZoneRecommendResponseDto ====="
sed -n '1,200p' src/main/java/com/wayble/server/explore/dto/recommend/WaybleZoneRecommendResponseDto.java

echo
echo "===== WaybleZoneSearchResponseDto ====="
sed -n '1,200p' src/main/java/com/wayble/server/explore/dto/search/response/WaybleZoneSearchResponseDto.java

Length of output: 3465


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "===== WaybleZoneInfoResponseDto (공통 DTO) ====="
sed -n '1,200p' src/main/java/com/wayble/server/explore/dto/common/WaybleZoneInfoResponseDto.java

echo
echo "===== UserPlaceService에서 대표 이미지 사용 확인 ====="
rg -n -A5 -B5 'imageUrl.*mainImageUrl|mainImageUrl.*imageUrl' src/main/java/com/wayble/server/user/service/UserPlaceService.java

Length of output: 1760


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "===== UserPlaceService snippet ====="
sed -n '100,160p' src/main/java/com/wayble/server/user/service/UserPlaceService.java

Length of output: 2710


대표 이미지 기준 일관성 필요: 리스트 API에서도 mainImageUrl 사용 제안

현재 코드베이스를 확인한 결과, 대표 이미지 노출 기준이 엔드포인트별로 상이합니다.

  • WaybleZoneService.getWaybleZones(src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java:48)
    • 리스트 응답에서
    .imageUrl(image != null ? image.getImageUrl() : null)
    zone.getWaybleZoneImageList().stream().findFirst()로 가져온 첫 번째 이미지를 사용
  • 그 외 엔드포인트
    • 상세 응답(WaybleZoneDetailResponseDto.builder().imageUrl(zone.getMainImageUrl()))
    • UserPlaceService.getZonesInPlace → .imageUrl(z.getMainImageUrl())
    • 검색/추천 DTO (WaybleZoneInfoResponseDtothumbnailImageUrl 필드)
    모두 WaybleZone.mainImageUrl을 기준으로 노출

사용자 경험(UX)의 일관성을 위해, 리스트 API(getWaybleZones)에서도 zone.getMainImageUrl()을 사용하도록 수정할 것을 권고드립니다.

수정 예시(diff):

–  .imageUrl(image != null ? image.getImageUrl() : null)
+  .imageUrl(zone.getMainImageUrl())
  • 대상 파일:
    src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java
    (라인 48 기준)
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/wayblezone/service/WaybleZoneService.java
around line 48, the list API currently sets imageUrl from the first image in
waybleZoneImageList; change it to use zone.getMainImageUrl() instead to match
other endpoints (detail, UserPlaceService, search/recommendation) for consistent
UX; simply replace the conditional that uses the first image with
.imageUrl(zone.getMainImageUrl()), keeping null-safety if needed (no additional
transformation) so the list response aligns with the rest of the application.

.photos(photoUrls)
.facilities(FacilityDto.builder()
.hasSlope(f.isHasSlope())
Expand Down
Loading