Skip to content

Commit

Permalink
feat: getCountrySafetyInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongho1209 committed Mar 22, 2024
1 parent 934bd38 commit 3dd9d77
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.trip.safe.common.webclient.dto.response

data class CountrySafetyInfoList(
val countrySafetyInfoList: List<CountrySafetyInfoElement>,
)

data class CountrySafetyInfoElement(
val content: String,
val countryEnName: String,
val countryName: String,
val id: String,
val title: String,
val wrtDt: String,
)
Original file line number Diff line number Diff line change
@@ -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)
}
}
17 changes: 17 additions & 0 deletions src/main/kotlin/com/trip/safe/safeinfo/service/SafeInfoService.kt
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 3dd9d77

Please sign in to comment.