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( fun getCans(
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
): ApiResponse<List<CanResponse>> { ): ApiResponse<List<CanResponse>> {
val isNotSelectedCurrency = member != null && member.id == 2L val forcedCurrency = if (member != null && (member.id == 2L || member.id == 4L || member.id == 44144L)) {
return ApiResponse.ok(service.getCans(isNotSelectedCurrency = isNotSelectedCurrency)) "JPY"
} else {
null
}
return ApiResponse.ok(service.getCans(forcedCurrency = forcedCurrency))
} }
@GetMapping("/status") @GetMapping("/status")

View File

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