@@ -2,12 +2,14 @@ package busanVibe.busan.domain.place.service
22
33import busanVibe.busan.domain.place.domain.Place
44import busanVibe.busan.domain.place.domain.PlaceImage
5+ import busanVibe.busan.domain.place.domain.PlaceLike
56import busanVibe.busan.domain.place.domain.VisitorDistribution
67import busanVibe.busan.domain.place.dto.PlaceMapResponseDTO
78import busanVibe.busan.domain.place.enums.PlaceType
89import busanVibe.busan.domain.place.repository.PlaceRepository
910import busanVibe.busan.domain.place.repository.VisitorDistributionRepository
1011import busanVibe.busan.domain.place.util.PlaceRedisUtil
12+ import busanVibe.busan.domain.user.service.login.AuthService
1113import busanVibe.busan.global.apiPayload.code.status.ErrorStatus
1214import busanVibe.busan.global.apiPayload.exception.GeneralException
1315import busanVibe.busan.global.apiPayload.exception.handler.ExceptionHandler
@@ -83,8 +85,11 @@ class PlaceCongestionQueryService(
8385 // Image -> list
8486 // Redis -> congestion
8587
88+ // 유저 조회
89+ val currentUser = AuthService ().getCurrentUser()
90+
8691 // 명소 조회
87- val place: Place ? = placeRepository.findByIdWithReviewAndImage (placeId)
92+ val place: Place ? = placeRepository.findByIdWithLIkeAndImage (placeId)
8893 place? : throw ExceptionHandler (ErrorStatus .PLACE_NOT_FOUND )
8994
9095 // 이미지 조회
@@ -94,6 +99,9 @@ class PlaceCongestionQueryService(
9499 .filter { it.imgUrl.isNotBlank() }
95100 .map { it.imgUrl }
96101
102+ // 좋아요 조회
103+ val placeLikes: Set <PlaceLike > = place.placeLikes
104+ val isLike = placeLikes.any { it.user.id == currentUser.id }
97105
98106 return PlaceMapResponseDTO .PlaceDefaultInfoDto (
99107 id = place.id,
@@ -103,7 +111,8 @@ class PlaceCongestionQueryService(
103111 longitude = place.longitude,
104112 address = place.address,
105113 isOpen = true ,
106- imgList = placeImageList
114+ imgList = placeImageList,
115+ isLike = isLike
107116 )
108117 }
109118
0 commit comments