update
This commit is contained in:
parent
33bdd83e97
commit
0468b48a89
@ -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<Key, Value> (
|
||||
baseUrl,
|
||||
getRoute,
|
||||
mapOf(
|
||||
keyParameterName to k.toHex(keySerializer)
|
||||
keyParameterName to keySerializer.encodeUrlQueryValue(k)
|
||||
)
|
||||
),
|
||||
valueNullableSerializer
|
||||
@ -35,7 +35,7 @@ class KtorStandartReadKeyValueRepo<Key, Value> (
|
||||
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<Key, Value> (
|
||||
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<Key, Value> (
|
||||
baseUrl,
|
||||
containsRoute,
|
||||
mapOf(
|
||||
keyParameterName to key.toHex(keySerializer)
|
||||
keyParameterName to keySerializer.encodeUrlQueryValue(key)
|
||||
),
|
||||
),
|
||||
Boolean.serializer(),
|
||||
|
@ -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 <K, V> Route.configureReadStandartKeyValueRepoRoutes (
|
||||
valueNullableSerializer: KSerializer<V?>,
|
||||
) {
|
||||
get(getRoute) {
|
||||
val key = call.uniloadFromQueryOrSendError(
|
||||
val key = call.decodeUrlQueryValueOrSendError(
|
||||
keyParameterName,
|
||||
keySerializer
|
||||
) ?: return@get
|
||||
@ -31,7 +29,7 @@ fun <K, V> 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 <K, V> 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 <K, V> Route.configureReadStandartKeyValueRepoRoutes (
|
||||
}
|
||||
|
||||
get(containsRoute) {
|
||||
val key = call.uniloadFromQueryOrSendError(
|
||||
val key = call.decodeUrlQueryValueOrSendError(
|
||||
keyParameterName,
|
||||
keySerializer
|
||||
) ?: return@get
|
||||
|
Loading…
Reference in New Issue
Block a user