test #420

Merged
klaus merged 9 commits from test into main 2026-05-01 06:40:59 +00:00
2 changed files with 10 additions and 10 deletions
Showing only changes of commit b98cc4b018 - Show all commits

View File

@@ -17,8 +17,12 @@ class CanController(private val service: CanService) {
fun getCans(
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
): ApiResponse<List<CanResponse>> {
val isNotSelectedCurrency = member != null && member.id == 2L
return ApiResponse.ok(service.getCans(isNotSelectedCurrency = isNotSelectedCurrency))
val forcedCurrency = if (member != null && (member.id == 2L || member.id == 4L || member.id == 44144L)) {
"JPY"
} else {
null
}
return ApiResponse.ok(service.getCans(forcedCurrency = forcedCurrency))
}
@GetMapping("/status")

View File

@@ -14,15 +14,11 @@ class CanService(
private val repository: CanRepository,
private val countryContext: CountryContext
) {
fun getCans(isNotSelectedCurrency: Boolean): List<CanResponse> {
val currency = if (isNotSelectedCurrency) {
null
} else {
when (countryContext.countryCode) {
fun getCans(forcedCurrency: String? = null): List<CanResponse> {
val currency = forcedCurrency ?: when (countryContext.countryCode) {
"KR" -> "KRW"
else -> "USD"
}
}
return repository.findAllByStatusAndCurrency(status = CanStatus.SALE, currency = currency)
}