This commit is contained in:
InsanusMokrassar 2020-08-31 00:40:58 +06:00
parent 4cc4d3d4ec
commit 617ac31ca1
2 changed files with 9 additions and 8 deletions

View File

@ -55,7 +55,7 @@ fun <T> ApplicationCall.decodeUrlQueryValue(
) )
} }
fun <T> ApplicationCall.decodeUrlQueryValueOrSendError( suspend fun <T> ApplicationCall.decodeUrlQueryValueOrSendError(
field: String, field: String,
deserializer: DeserializationStrategy<T> deserializer: DeserializationStrategy<T>
) = decodeUrlQueryValue(field, deserializer).also { ) = decodeUrlQueryValue(field, deserializer).also {

View File

@ -1,6 +1,7 @@
package com.insanusmokrassar.postssystem.utils.repos.ktor.client.one_to_many package com.insanusmokrassar.postssystem.utils.repos.ktor.client.one_to_many
import com.insanusmokrassar.postssystem.ktor.* import com.insanusmokrassar.postssystem.ktor.*
import com.insanusmokrassar.postssystem.ktor.client.encodeUrlQueryValue
import com.insanusmokrassar.postssystem.ktor.client.uniget import com.insanusmokrassar.postssystem.ktor.client.uniget
import com.insanusmokrassar.postssystem.utils.common.pagination.Pagination import com.insanusmokrassar.postssystem.utils.common.pagination.Pagination
import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult
@ -24,8 +25,8 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
baseUrl, baseUrl,
getRoute, getRoute,
mapOf( mapOf(
keyParameterName to k.toHex(keySerializer), keyParameterName to keySerializer.encodeUrlQueryValue(k),
reversedParameterName to reversed.toHex(Boolean.serializer()) reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed)
) + pagination.asUrlQueryParts ) + pagination.asUrlQueryParts
), ),
paginationValueResultSerializer paginationValueResultSerializer
@ -36,7 +37,7 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
baseUrl, baseUrl,
keysRoute, keysRoute,
mapOf( mapOf(
reversedParameterName to reversed.toHex(Boolean.serializer()) reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed)
) + pagination.asUrlQueryParts ) + pagination.asUrlQueryParts
), ),
paginationKeyResultSerializer paginationKeyResultSerializer
@ -46,7 +47,7 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
buildStandardUrl( buildStandardUrl(
baseUrl, baseUrl,
containsByKeyRoute, containsByKeyRoute,
mapOf(keyParameterName to k.toHex(keySerializer)) mapOf(keyParameterName to keySerializer.encodeUrlQueryValue(k))
), ),
Boolean.serializer() Boolean.serializer()
) )
@ -56,8 +57,8 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
baseUrl, baseUrl,
containsByKeyValueRoute, containsByKeyValueRoute,
mapOf( mapOf(
keyParameterName to k.toHex(keySerializer), keyParameterName to keySerializer.encodeUrlQueryValue(k),
valueParameterName to v.toHex(valueSerializer), valueParameterName to valueSerializer.encodeUrlQueryValue(v),
) )
), ),
Boolean.serializer() Boolean.serializer()
@ -68,7 +69,7 @@ class KtorOneToManyReadKeyValueRepo<Key, Value> (
baseUrl, baseUrl,
countByKeyRoute, countByKeyRoute,
mapOf( mapOf(
keyParameterName to k.toHex(keySerializer) keyParameterName to keySerializer.encodeUrlQueryValue(k)
) )
), ),
Long.serializer() Long.serializer()