Skip to content

Commit

Permalink
feat: 카카오맵 장소 ID로 장소 조회 기능 추가 (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Namgyu11 committed Dec 25, 2024
1 parent 9244e07 commit 65ab4e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import org.springframework.data.jpa.repository.JpaRepository

interface PlaceJpaRepository : JpaRepository<PlaceEntity, Long> {
fun existsByKakaoMapPlaceId(kakaoMapPlaceId: String): Boolean

fun findByKakaoMapPlaceId(kakaoMapPlaceId: String): PlaceEntity
}

0 comments on commit 65ab4e5

Please sign in to comment.