From 0468b48a89e2f1cb56ff1568a40803f7fcf299b5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 1 Sep 2020 21:05:20 +0600 Subject: [PATCH] update --- .../client/key_value/KtorStandartReadKeyValueRepo.kt | 10 +++++----- .../server/key_value/KtorStandartReadKeyValueRepo.kt | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/key_value/KtorStandartReadKeyValueRepo.kt b/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/key_value/KtorStandartReadKeyValueRepo.kt index 0cab8c9b..dbf265b5 100644 --- a/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/key_value/KtorStandartReadKeyValueRepo.kt +++ b/utils/repos/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/client/key_value/KtorStandartReadKeyValueRepo.kt @@ -2,8 +2,8 @@ package com.insanusmokrassar.postssystem.utils.repos.ktor.client.key_value import com.insanusmokrassar.postssystem.ktor.asUrlQueryParts import com.insanusmokrassar.postssystem.ktor.buildStandardUrl +import com.insanusmokrassar.postssystem.ktor.client.encodeUrlQueryValue import com.insanusmokrassar.postssystem.ktor.client.uniget -import com.insanusmokrassar.postssystem.ktor.toHex import com.insanusmokrassar.postssystem.utils.common.pagination.Pagination import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult import com.insanusmokrassar.postssystem.utils.repos.StandardReadKeyValueRepo @@ -24,7 +24,7 @@ class KtorStandartReadKeyValueRepo ( baseUrl, getRoute, mapOf( - keyParameterName to k.toHex(keySerializer) + keyParameterName to keySerializer.encodeUrlQueryValue(k) ) ), valueNullableSerializer @@ -35,7 +35,7 @@ class KtorStandartReadKeyValueRepo ( baseUrl, valuesRoute, mapOf( - reversedParameterName to reversed.toHex(Boolean.serializer()) + reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed) ) + pagination.asUrlQueryParts ), PaginationResult.serializer(valueSerializer) @@ -46,7 +46,7 @@ class KtorStandartReadKeyValueRepo ( baseUrl, keysRoute, mapOf( - reversedParameterName to reversed.toHex(Boolean.serializer()) + reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed) ) + pagination.asUrlQueryParts ), PaginationResult.serializer(keySerializer) @@ -57,7 +57,7 @@ class KtorStandartReadKeyValueRepo ( baseUrl, containsRoute, mapOf( - keyParameterName to key.toHex(keySerializer) + keyParameterName to keySerializer.encodeUrlQueryValue(key) ), ), Boolean.serializer(), diff --git a/utils/repos/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/server/key_value/KtorStandartReadKeyValueRepo.kt b/utils/repos/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/server/key_value/KtorStandartReadKeyValueRepo.kt index f2eeafc4..e0e6e784 100644 --- a/utils/repos/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/server/key_value/KtorStandartReadKeyValueRepo.kt +++ b/utils/repos/ktor/server/src/jvmMain/kotlin/com/insanusmokrassar/postssystem/utils/repos/ktor/server/key_value/KtorStandartReadKeyValueRepo.kt @@ -1,8 +1,6 @@ package com.insanusmokrassar.postssystem.utils.repos.ktor.server.key_value -import com.insanusmokrassar.postssystem.ktor.server.extractPagination -import com.insanusmokrassar.postssystem.ktor.server.unianswer -import com.insanusmokrassar.postssystem.ktor.server.uniloadFromQueryOrSendError +import com.insanusmokrassar.postssystem.ktor.server.* import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult import com.insanusmokrassar.postssystem.utils.repos.StandardReadKeyValueRepo import com.insanusmokrassar.postssystem.utils.repos.ktor.common.key_value.* @@ -18,7 +16,7 @@ fun Route.configureReadStandartKeyValueRepoRoutes ( valueNullableSerializer: KSerializer, ) { get(getRoute) { - val key = call.uniloadFromQueryOrSendError( + val key = call.decodeUrlQueryValueOrSendError( keyParameterName, keySerializer ) ?: return@get @@ -31,7 +29,7 @@ fun Route.configureReadStandartKeyValueRepoRoutes ( get(valuesRoute) { val parination = call.request.queryParameters.extractPagination; - val reversed = call.uniloadFromQueryOrSendError( + val reversed = call.decodeUrlQueryValueOrSendError( reversedParameterName, Boolean.serializer() ) ?: return@get @@ -44,7 +42,7 @@ fun Route.configureReadStandartKeyValueRepoRoutes ( get(keysRoute) { val parination = call.request.queryParameters.extractPagination; - val reversed = call.uniloadFromQueryOrSendError( + val reversed = call.decodeUrlQueryValueOrSendError( reversedParameterName, Boolean.serializer() ) ?: return@get @@ -56,7 +54,7 @@ fun Route.configureReadStandartKeyValueRepoRoutes ( } get(containsRoute) { - val key = call.uniloadFromQueryOrSendError( + val key = call.decodeUrlQueryValueOrSendError( keyParameterName, keySerializer ) ?: return@get