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.asUrlQueryParts
|
||||||
import com.insanusmokrassar.postssystem.ktor.buildStandardUrl
|
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.client.uniget
|
||||||
import com.insanusmokrassar.postssystem.ktor.toHex
|
|
||||||
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
|
||||||
import com.insanusmokrassar.postssystem.utils.repos.StandardReadKeyValueRepo
|
import com.insanusmokrassar.postssystem.utils.repos.StandardReadKeyValueRepo
|
||||||
@ -24,7 +24,7 @@ class KtorStandartReadKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
getRoute,
|
getRoute,
|
||||||
mapOf(
|
mapOf(
|
||||||
keyParameterName to k.toHex(keySerializer)
|
keyParameterName to keySerializer.encodeUrlQueryValue(k)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
valueNullableSerializer
|
valueNullableSerializer
|
||||||
@ -35,7 +35,7 @@ class KtorStandartReadKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
valuesRoute,
|
valuesRoute,
|
||||||
mapOf(
|
mapOf(
|
||||||
reversedParameterName to reversed.toHex(Boolean.serializer())
|
reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed)
|
||||||
) + pagination.asUrlQueryParts
|
) + pagination.asUrlQueryParts
|
||||||
),
|
),
|
||||||
PaginationResult.serializer(valueSerializer)
|
PaginationResult.serializer(valueSerializer)
|
||||||
@ -46,7 +46,7 @@ class KtorStandartReadKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
keysRoute,
|
keysRoute,
|
||||||
mapOf(
|
mapOf(
|
||||||
reversedParameterName to reversed.toHex(Boolean.serializer())
|
reversedParameterName to Boolean.serializer().encodeUrlQueryValue(reversed)
|
||||||
) + pagination.asUrlQueryParts
|
) + pagination.asUrlQueryParts
|
||||||
),
|
),
|
||||||
PaginationResult.serializer(keySerializer)
|
PaginationResult.serializer(keySerializer)
|
||||||
@ -57,7 +57,7 @@ class KtorStandartReadKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
containsRoute,
|
containsRoute,
|
||||||
mapOf(
|
mapOf(
|
||||||
keyParameterName to key.toHex(keySerializer)
|
keyParameterName to keySerializer.encodeUrlQueryValue(key)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Boolean.serializer(),
|
Boolean.serializer(),
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.insanusmokrassar.postssystem.utils.repos.ktor.server.key_value
|
package com.insanusmokrassar.postssystem.utils.repos.ktor.server.key_value
|
||||||
|
|
||||||
import com.insanusmokrassar.postssystem.ktor.server.extractPagination
|
import com.insanusmokrassar.postssystem.ktor.server.*
|
||||||
import com.insanusmokrassar.postssystem.ktor.server.unianswer
|
|
||||||
import com.insanusmokrassar.postssystem.ktor.server.uniloadFromQueryOrSendError
|
|
||||||
import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult
|
import com.insanusmokrassar.postssystem.utils.common.pagination.PaginationResult
|
||||||
import com.insanusmokrassar.postssystem.utils.repos.StandardReadKeyValueRepo
|
import com.insanusmokrassar.postssystem.utils.repos.StandardReadKeyValueRepo
|
||||||
import com.insanusmokrassar.postssystem.utils.repos.ktor.common.key_value.*
|
import com.insanusmokrassar.postssystem.utils.repos.ktor.common.key_value.*
|
||||||
@ -18,7 +16,7 @@ fun <K, V> Route.configureReadStandartKeyValueRepoRoutes (
|
|||||||
valueNullableSerializer: KSerializer<V?>,
|
valueNullableSerializer: KSerializer<V?>,
|
||||||
) {
|
) {
|
||||||
get(getRoute) {
|
get(getRoute) {
|
||||||
val key = call.uniloadFromQueryOrSendError(
|
val key = call.decodeUrlQueryValueOrSendError(
|
||||||
keyParameterName,
|
keyParameterName,
|
||||||
keySerializer
|
keySerializer
|
||||||
) ?: return@get
|
) ?: return@get
|
||||||
@ -31,7 +29,7 @@ fun <K, V> Route.configureReadStandartKeyValueRepoRoutes (
|
|||||||
|
|
||||||
get(valuesRoute) {
|
get(valuesRoute) {
|
||||||
val parination = call.request.queryParameters.extractPagination;
|
val parination = call.request.queryParameters.extractPagination;
|
||||||
val reversed = call.uniloadFromQueryOrSendError(
|
val reversed = call.decodeUrlQueryValueOrSendError(
|
||||||
reversedParameterName,
|
reversedParameterName,
|
||||||
Boolean.serializer()
|
Boolean.serializer()
|
||||||
) ?: return@get
|
) ?: return@get
|
||||||
@ -44,7 +42,7 @@ fun <K, V> Route.configureReadStandartKeyValueRepoRoutes (
|
|||||||
|
|
||||||
get(keysRoute) {
|
get(keysRoute) {
|
||||||
val parination = call.request.queryParameters.extractPagination;
|
val parination = call.request.queryParameters.extractPagination;
|
||||||
val reversed = call.uniloadFromQueryOrSendError(
|
val reversed = call.decodeUrlQueryValueOrSendError(
|
||||||
reversedParameterName,
|
reversedParameterName,
|
||||||
Boolean.serializer()
|
Boolean.serializer()
|
||||||
) ?: return@get
|
) ?: return@get
|
||||||
@ -56,7 +54,7 @@ fun <K, V> Route.configureReadStandartKeyValueRepoRoutes (
|
|||||||
}
|
}
|
||||||
|
|
||||||
get(containsRoute) {
|
get(containsRoute) {
|
||||||
val key = call.uniloadFromQueryOrSendError(
|
val key = call.decodeUrlQueryValueOrSendError(
|
||||||
keyParameterName,
|
keyParameterName,
|
||||||
keySerializer
|
keySerializer
|
||||||
) ?: return@get
|
) ?: return@get
|
||||||
|
Loading…
Reference in New Issue
Block a user