diff --git a/src/main/kotlin/com/trip/safe/common/webclient/dto/response/CountrySafetyInfoList.kt b/src/main/kotlin/com/trip/safe/common/webclient/dto/response/CountrySafetyInfoList.kt new file mode 100644 index 0000000..e93d97c --- /dev/null +++ b/src/main/kotlin/com/trip/safe/common/webclient/dto/response/CountrySafetyInfoList.kt @@ -0,0 +1,14 @@ +package com.trip.safe.common.webclient.dto.response + +data class CountrySafetyInfoList( + val countrySafetyInfoList: List, +) + +data class CountrySafetyInfoElement( + val content: String, + val countryEnName: String, + val countryName: String, + val id: String, + val title: String, + val wrtDt: String, +) diff --git a/src/main/kotlin/com/trip/safe/safeinfo/presentation/SafeInfoController.kt b/src/main/kotlin/com/trip/safe/safeinfo/presentation/SafeInfoController.kt new file mode 100644 index 0000000..963c064 --- /dev/null +++ b/src/main/kotlin/com/trip/safe/safeinfo/presentation/SafeInfoController.kt @@ -0,0 +1,22 @@ +package com.trip.safe.safeinfo.presentation + +import com.trip.safe.common.webclient.dto.response.CountrySafetyInfoElement +import com.trip.safe.safeinfo.service.SafeInfoService +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.RestController + +@RequestMapping("/safeInfo") +@RestController +class SafeInfoController( + private val safeInfoService: SafeInfoService, +) { + + @GetMapping + suspend fun getCountrySafetyInfo( + @RequestParam("searchId") searchId: String + ): CountrySafetyInfoElement { + return safeInfoService.getCountrySafetyInfo(searchId) + } +} diff --git a/src/main/kotlin/com/trip/safe/safeinfo/service/SafeInfoService.kt b/src/main/kotlin/com/trip/safe/safeinfo/service/SafeInfoService.kt new file mode 100644 index 0000000..badcf1b --- /dev/null +++ b/src/main/kotlin/com/trip/safe/safeinfo/service/SafeInfoService.kt @@ -0,0 +1,17 @@ +package com.trip.safe.safeinfo.service + +import com.trip.safe.common.webclient.client.CountrySafetyWebClient +import com.trip.safe.common.webclient.dto.response.CountrySafetyInfoElement +import com.trip.safe.safeinfo.domain.CountrySafeInfoRepository +import org.springframework.stereotype.Service + +@Service +class SafeInfoService( + private val countrySafeInfoRepository: CountrySafeInfoRepository, + private val countrySafetyWebClient: CountrySafetyWebClient, +) { + + suspend fun getCountrySafetyInfo(searchId: String): CountrySafetyInfoElement { + return countrySafetyWebClient.getCountrySafetyInfo(searchId) + } +}