diff --git a/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceGetResponse.java b/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceGetResponse.java
index 4f79a9d..5e32a0e 100644
--- a/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceGetResponse.java
+++ b/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceGetResponse.java
@@ -22,6 +22,9 @@ public class PlaceGetResponse {
@Schema(description = "상세 페이지 URL", example = "http://place.map.kakao.com/1520672825")
private String url;
+ @Schema(description = "썸네일 이미지 url", example = "https://t1.daumcdn.net/place/75B5CF9ACCF84162A7E13CB1FD4D5D43")
+ private String thumbnailImage;
+
@Schema(description = "
카테고리 그룹 코드. 목록은 다음과 같음
" +
"" +
"- MT1 - 대형마트
" +
@@ -132,6 +135,7 @@ public class PlaceGetResponse {
public static PlaceGetResponse of(
KakaoPlaceGetResponse kakaoResponse,
+ String thumbnailImage,
BookmarkType bookmarkType,
Long bookmarkId
) {
@@ -145,6 +149,7 @@ public static PlaceGetResponse of(
kakaoResponse.getId(),
kakaoResponse.getPlace_name(),
kakaoResponse.getPlace_url(),
+ thumbnailImage,
categoryGroupCode,
kakaoResponse.getCategory_name(),
kakaoResponse.getCategory(),
@@ -159,7 +164,7 @@ public static PlaceGetResponse of(
);
}
- public static PlaceGetResponse ofWithoutBookmark(KakaoPlaceGetResponse kakaoResponse) {
- return of(kakaoResponse, null, null);
+ public static PlaceGetResponse ofWithoutBookmark(KakaoPlaceGetResponse kakaoResponse, String thumbnailImage) {
+ return of(kakaoResponse, thumbnailImage, null, null);
}
}
diff --git a/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceSearchResponse.java b/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceSearchResponse.java
index 579e762..a90caa1 100644
--- a/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceSearchResponse.java
+++ b/src/main/java/com/dnd/reetplace/app/dto/place/response/PlaceSearchResponse.java
@@ -24,6 +24,9 @@ public class PlaceSearchResponse {
@Schema(description = "상세 페이지 URL", example = "http://place.map.kakao.com/1520672825")
private String url;
+ @Schema(description = "썸네일 이미지 url", example = "https://t1.daumcdn.net/place/75B5CF9ACCF84162A7E13CB1FD4D5D43")
+ private String thumbnailImage;
+
@Schema(description = "카테고리 그룹 코드. 목록은 다음과 같음
" +
"" +
"- MT1 - 대형마트
" +
@@ -137,6 +140,7 @@ public class PlaceSearchResponse {
public static PlaceSearchResponse of(
KakaoPlaceSearchResponse kakaoResponse,
+ String thumbnailImage,
BookmarkType bookmarkType,
Long bookmarkId,
Short rate
@@ -168,6 +172,7 @@ public static PlaceSearchResponse of(
kakaoResponse.getId(),
kakaoResponse.getPlace_name(),
kakaoResponse.getPlace_url(),
+ thumbnailImage,
categoryGroupCode,
kakaoResponse.getCategory_name(),
category,
@@ -183,7 +188,7 @@ public static PlaceSearchResponse of(
);
}
- public static PlaceSearchResponse ofWithoutBookmark(KakaoPlaceSearchResponse kakaoResponse) {
- return of(kakaoResponse, null, null, null);
+ public static PlaceSearchResponse ofWithoutBookmark(KakaoPlaceSearchResponse kakaoResponse, String thumbnailImage) {
+ return of(kakaoResponse, thumbnailImage, null, null, null);
}
}
diff --git a/src/main/java/com/dnd/reetplace/app/service/PlaceService.java b/src/main/java/com/dnd/reetplace/app/service/PlaceService.java
index c30a829..07f5088 100644
--- a/src/main/java/com/dnd/reetplace/app/service/PlaceService.java
+++ b/src/main/java/com/dnd/reetplace/app/service/PlaceService.java
@@ -33,6 +33,7 @@ public class PlaceService {
private final BookmarkRepository bookmarkRepository;
private final MemberRepository memberRepository;
private final KakaoHttpRequestService kakaoHttpRequestService;
+ private final ScrapService scrapService;
public static final String MEXICAN_KEYWORD = "멕시칸,브라질";
public static final String ASIA_KEYWORD = "아시아음식";
@@ -140,7 +141,7 @@ private List updateGetPlaceIsBookmark(HttpServletRequest httpS
Member loginMember = findLoginMember(httpServletRequest);
if (loginMember == null) {
return result.stream()
- .map(PlaceGetResponse::ofWithoutBookmark)
+ .map(response -> PlaceGetResponse.ofWithoutBookmark(response, scrapService.getPlaceThumbnailUrl(response.getId())))
.toList();
}
List bookmarkList = bookmarkRepository.findAllByMember(loginMember.getId());
@@ -151,9 +152,10 @@ private List updateGetPlaceIsBookmark(HttpServletRequest httpS
.findFirst()
.map(bookmark -> PlaceGetResponse.of(
place,
+ bookmark.getThumbnailUrl(),
bookmark.getType(),
bookmark.getId()))
- .orElse(PlaceGetResponse.ofWithoutBookmark(place)))
+ .orElse(PlaceGetResponse.ofWithoutBookmark(place, scrapService.getPlaceThumbnailUrl(place.getId()))))
.toList();
}
@@ -170,7 +172,7 @@ private List updateSearchPlaceIsBookmark(HttpServletRequest
Member loginMember = findLoginMember(httpServletRequest);
if (loginMember == null) {
return result.stream()
- .map(PlaceSearchResponse::ofWithoutBookmark)
+ .map(response -> PlaceSearchResponse.ofWithoutBookmark(response, scrapService.getPlaceThumbnailUrl(response.getId())))
.filter(place -> place.getCategory() != null)
.toList();
}
@@ -182,10 +184,11 @@ private List updateSearchPlaceIsBookmark(HttpServletRequest
.findFirst()
.map(bookmark -> PlaceSearchResponse.of(
place,
+ bookmark.getThumbnailUrl(),
bookmark.getType(),
bookmark.getId(),
bookmark.getRate()))
- .orElse(PlaceSearchResponse.ofWithoutBookmark(place)))
+ .orElse(PlaceSearchResponse.ofWithoutBookmark(place, scrapService.getPlaceThumbnailUrl(place.getId()))))
.filter(place -> place.getCategory() != null)
.toList();
}