From 8a4934a65a2f9b785aa1e00417c5a34ea0e3dbb6 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 15 Aug 2020 12:46:59 +0600 Subject: [PATCH] upfixes --- .../ktor/client/ReadPublishingKeysRepoKtorClient.kt | 4 ++-- .../postssystem/publishing/ktor/PublishingKeysRoutes.kt | 2 ++ .../ktor/server/PublishingKeysRepoRoutingConfigurator.kt | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/publishing/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/client/ReadPublishingKeysRepoKtorClient.kt b/publishing/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/client/ReadPublishingKeysRepoKtorClient.kt index 7c86744d..216b8428 100644 --- a/publishing/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/client/ReadPublishingKeysRepoKtorClient.kt +++ b/publishing/ktor/client/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/client/ReadPublishingKeysRepoKtorClient.kt @@ -15,12 +15,12 @@ class ReadPublishingKeysRepoKtorClient ( private val client: HttpClient = HttpClient() ) : ReadPublishingKeysRepo { override suspend fun getPostIdByTriggerControlKey(key: TriggerControlKey): PostId? = client.uniget( - "$baseUrl/$getPostIdByTriggerControlKeyRoute", + "$baseUrl/$getPostIdByTriggerControlKeyRoute/$key", PostId.serializer().nullable ) override suspend fun getTriggerControlKeyByPostId(postId: PostId): TriggerControlKey? = client.uniget( - "$baseUrl/$getTriggerControlKeyByPostIdRoute", + "$baseUrl/$getTriggerControlKeyByPostIdRoute/$postId", TriggerControlKey.serializer().nullable ) } \ No newline at end of file diff --git a/publishing/ktor/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/PublishingKeysRoutes.kt b/publishing/ktor/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/PublishingKeysRoutes.kt index 0cb5cf0a..91c89a2b 100644 --- a/publishing/ktor/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/PublishingKeysRoutes.kt +++ b/publishing/ktor/common/src/commonMain/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/PublishingKeysRoutes.kt @@ -1,5 +1,7 @@ package com.insanusmokrassar.postssystem.publishing.ktor +const val publishingKeysRootRoute = "publishingKeys" + const val getPostIdByTriggerControlKeyRoute = "getPostIdByTriggerControlKey" const val getTriggerControlKeyByPostIdRoute = "getTriggerControlKeyByPostId" diff --git a/publishing/ktor/server/src/main/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/server/PublishingKeysRepoRoutingConfigurator.kt b/publishing/ktor/server/src/main/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/server/PublishingKeysRepoRoutingConfigurator.kt index 56f584a8..8f5918a7 100644 --- a/publishing/ktor/server/src/main/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/server/PublishingKeysRepoRoutingConfigurator.kt +++ b/publishing/ktor/server/src/main/kotlin/com/insanusmokrassar/postssystem/publishing/ktor/server/PublishingKeysRepoRoutingConfigurator.kt @@ -2,13 +2,17 @@ package com.insanusmokrassar.postssystem.publishing.ktor.server import com.insanusmokrassar.postssystem.core.publishing.repos.PublishingKeysRepo import com.insanusmokrassar.postssystem.ktor.server.configurators.ApplicationRoutingConfigurator +import com.insanusmokrassar.postssystem.publishing.ktor.publishingKeysRootRoute import io.ktor.routing.Route +import io.ktor.routing.route fun Route.configurePublishingKeysRepoRoutes ( proxyTo: PublishingKeysRepo ) { - configureReadPublishingKeysRepoRoutes(proxyTo) - configureWritePublishingKeysRepoRoutes(proxyTo) + route(publishingKeysRootRoute) { + configureReadPublishingKeysRepoRoutes(proxyTo) + configureWritePublishingKeysRepoRoutes(proxyTo) + } } class PublishingKeysRepoRoutingConfigurator (