From 65ab4e5dc6fab5f9613f715aca6170d1a1d72fa2 Mon Sep 17 00:00:00 2001 From: Namgyu11 <103015031+Namgyu11@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:01:29 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=EB=A7=B5=20?= =?UTF-8?q?=EC=9E=A5=EC=86=8C=20ID=EB=A1=9C=20=EC=9E=A5=EC=86=8C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#47)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../woocobe/place/domain/gateway/PlaceStorageGateway.kt | 4 +++- .../place/infrastructure/gateway/JpaPlaceStorageGateway.kt | 6 +++--- .../place/infrastructure/storage/PlaceJpaRepository.kt | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/kr/wooco/woocobe/place/domain/gateway/PlaceStorageGateway.kt b/src/main/kotlin/kr/wooco/woocobe/place/domain/gateway/PlaceStorageGateway.kt index 617c616..08cd6ca 100644 --- a/src/main/kotlin/kr/wooco/woocobe/place/domain/gateway/PlaceStorageGateway.kt +++ b/src/main/kotlin/kr/wooco/woocobe/place/domain/gateway/PlaceStorageGateway.kt @@ -7,5 +7,7 @@ interface PlaceStorageGateway { fun getByPlaceId(placeId: Long): Place? - fun existsByKakaoMapPlaceId(placeId: String): Boolean + fun existsByKakaoMapPlaceId(kakaoMapPlaceId: String): Boolean + + fun getByKakaoMapPlaceId(kakaoMapPlaceId: String): Place } diff --git a/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/gateway/JpaPlaceStorageGateway.kt b/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/gateway/JpaPlaceStorageGateway.kt index d4fc90c..2fbce08 100644 --- a/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/gateway/JpaPlaceStorageGateway.kt +++ b/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/gateway/JpaPlaceStorageGateway.kt @@ -4,13 +4,11 @@ import kr.wooco.woocobe.place.domain.gateway.PlaceStorageGateway import kr.wooco.woocobe.place.domain.model.Place import kr.wooco.woocobe.place.infrastructure.storage.PlaceEntity import kr.wooco.woocobe.place.infrastructure.storage.PlaceJpaRepository -import kr.wooco.woocobe.user.infrastructure.storage.UserJpaRepository import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component @Component class JpaPlaceStorageGateway( - private val userJpaRepository: UserJpaRepository, private val placeJpaRepository: PlaceJpaRepository, ) : PlaceStorageGateway { override fun save(place: Place): Place { @@ -21,5 +19,7 @@ class JpaPlaceStorageGateway( override fun getByPlaceId(placeId: Long): Place? = placeJpaRepository.findByIdOrNull(placeId)?.toDomain() - override fun existsByKakaoMapPlaceId(placeId: String): Boolean = placeJpaRepository.existsByKakaoMapPlaceId(placeId) + override fun existsByKakaoMapPlaceId(kakaoMapPlaceId: String): Boolean = placeJpaRepository.existsByKakaoMapPlaceId(kakaoMapPlaceId) + + override fun getByKakaoMapPlaceId(kakaoMapPlaceId: String): Place = placeJpaRepository.findByKakaoMapPlaceId(kakaoMapPlaceId).toDomain() } diff --git a/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/storage/PlaceJpaRepository.kt b/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/storage/PlaceJpaRepository.kt index 94c60e5..0cbf7a6 100644 --- a/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/storage/PlaceJpaRepository.kt +++ b/src/main/kotlin/kr/wooco/woocobe/place/infrastructure/storage/PlaceJpaRepository.kt @@ -4,4 +4,6 @@ import org.springframework.data.jpa.repository.JpaRepository interface PlaceJpaRepository : JpaRepository { fun existsByKakaoMapPlaceId(kakaoMapPlaceId: String): Boolean + + fun findByKakaoMapPlaceId(kakaoMapPlaceId: String): PlaceEntity }