From a3c4b67304999ed24195d650da57042d74d38106 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 2 Dec 2020 17:51:43 +0600 Subject: [PATCH] update published posts repo --- PostsSystem.drawio | 2 +- gradle.properties | 4 +- .../core/publishing/PublishingTrigger.kt | 23 +++--- .../publishing/repos/PublishedPostsRepo.kt | 56 +++++++------ .../exposed/ExposedPublishedPostsRepo.kt | 81 +++++++++++++++++++ 5 files changed, 123 insertions(+), 43 deletions(-) create mode 100644 publishing/exposed/src/jvmMain/kotlin/dev/inmo/postssystem/core/publishing/exposed/ExposedPublishedPostsRepo.kt diff --git a/PostsSystem.drawio b/PostsSystem.drawio index a7cfdd76..53f0b27e 100644 --- a/PostsSystem.drawio +++ b/PostsSystem.drawio @@ -1 +1 @@ -7V1vk5o4HP40zvRebAeCoL7s2m07c9e5Xr3ptS8jZIUTiQOxu96nv0QTgUQRVyCh673oLTFR8vD8/uaXMHCmq+ePKVyHn3GA4gGwgueB834AgD1xAf0fa9nuW8b2aN+wSKOAd8obZtF/iDdavHUTBSgrdSQYxyRalxt9nCTIJ6U2mKb4qdztEcflX13DBVIaZj6M1dZ/ooCEfBaulbd/QtEiFL9sW/yTFRSdeUMWwgA/FZqch4EzTTEm+79Wz1MUM/AELvtxH058erixFCWkzoD/Pi3/+uZB6N/92G6+xyGGZHrn7L/lJ4w3fML8ZslWIIACCgi/xCkJ8QInMH7IW+9TvEkCxH7Gold5nz8wXtNGmzb+iwjZ8qcLNwTTppCsYv6pOhU+uwxvUh9V3L+gBEwXiFT049Nicyn8AAfqI8IrRNIt7ZCiGJLoZ/nhQ86hxaFfDjP9gyN9AeruK0F9aBTqtoL6F5yRbLbNCFopDyCHl2H1FEYEzdZwB8sTVXU1ofyJUoKeKyfPP3WEnuCKcsgvn3KtY4suYUHjeFZLcI16TlJQk6SeUSQd31DXgPrkhroOhWzpQJmCm26/s/FvXXH5g3/d7uL9c+lqy6/afzq23fTj4UO/4Ije80lTA8aSDdnfKR8lPeT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quc0y14SdUmLPeYBFhPMX4vtVfd2Oql4tpSFADa4jVEu6YT1a3lgg2/IcCI6KNwKFNs8ArVtctLSNSFO2aLnuDocyWNOGf/i1C2ZDkqwAzuswC5EgLjVZyNn+1uqq7prMxkoOxp2oacyMCE8e2lD/XauC+xspKZsjbyQ2UPWySQhSHl/ESeXJY6ll1gBRm4HZyVxoGlAINn2sZuKw22imaLp/+iT8/+cPh+6qHBz+C6421sJYUxbK/+3vjyjfexD56PeFv5PVAQwxm5W4PbXTfsHd2aTapXNtU0Lfaa00ztm6GxX2dH97bNusr9xAswybDnM1+w0OygFz9SDAoHuu0gn3NMFLZ1dsaZWFwWhZXhMgo+iChfeFuxJ6HWAyZn51mVg0aOaXfAaolyG3U66BQFlQIxsAMFD4xoTX8VubvTCMZp+3+p7BdzQnoCgseqY4KgSCBa+cE/9nGcBaR99Ehqsg9YprigrSMRRsHqNQd5so/LFpWORzgbC07FFnmeQxDSxzz45+lBU33laXuk0UjVqen3Skz71YcI77ct3YpOx0I1Pf6LEkxsyq7/MU8LmeMbnfnKtVEpFanU7Rf2LzImCXzK8mJZzUhcZEbOanH4CgMHwLC/YUyEHGJ7w6xVnYNLrYqYptTiSpT1lEU/BP1MQ1KW7UgyXqjWyoj6QxpGvMsCksd0eWYKB47i4oamlLjpRwAPofDPX/5pj4PZ6i6ePN8/PKdfPka/GeJXsT/5DcHqmVOh0lx5tVOpvdahppuman1Rh0Nl0Y5MJMUUNr8hxGKX5d/TEomp8q+SOTf/Bw== \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e4239360..ffcbb98d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,14 +12,14 @@ kotlin_coroutines_version=1.4.2 kotlin_serialisation_core_version=1.0.1 kotlin_exposed_version=0.28.1 -ktor_version=1.4.2 +ktor_version=1.4.3 klockVersion=2.0.0 uuidVersion=0.2.3 exposed_version=0.28.1 test_sqlite_version=3.32.3.2 -microutils_version=0.4.7 +microutils_version=0.4.9 javax_activation_version=1.1.1 diff --git a/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/PublishingTrigger.kt b/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/PublishingTrigger.kt index dfdbdc08..37c5d191 100644 --- a/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/PublishingTrigger.kt +++ b/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/PublishingTrigger.kt @@ -1,14 +1,15 @@ package dev.inmo.postssystem.core.publishing +import dev.inmo.micro_utils.repos.create import dev.inmo.postssystem.core.post.PostId import dev.inmo.postssystem.core.post.RegisteredPost import dev.inmo.postssystem.core.post.repo.PostsRepo -import dev.inmo.postssystem.core.publishing.repos.PublishedPostsWriteRepo -import dev.inmo.postssystem.core.publishing.repos.PublishingKeysRepo +import dev.inmo.postssystem.core.publishing.repos.* import kotlinx.coroutines.flow.* +import kotlinx.serialization.Serializable interface PublishingTrigger { - val postingTriggeredFlow: SharedFlow + val postingTriggeredFlow: SharedFlow suspend fun triggerPosting( triggerControlKey: TriggerControlKey @@ -20,23 +21,17 @@ class BusinessPublishingTrigger( private val publishedPostsRepo: PublishedPostsWriteRepo, private val publishingKeysRepo: PublishingKeysRepo ) : PublishingTrigger { - private val _postingTriggeredFlow: MutableSharedFlow = MutableSharedFlow() - override val postingTriggeredFlow: SharedFlow = _postingTriggeredFlow.asSharedFlow() + private val _postingTriggeredFlow: MutableSharedFlow = MutableSharedFlow() + override val postingTriggeredFlow: SharedFlow = _postingTriggeredFlow.asSharedFlow() override suspend fun triggerPosting(triggerControlKey: TriggerControlKey): PostId? { val postId = publishingKeysRepo.getPostIdByTriggerControlKey(triggerControlKey) ?: return null publishingKeysRepo.unsetPostTriggerControlKey(postId) return postsRepo.getPostById(postId) ?.let { post -> - publishedPostsRepo.registerPublishedPost(post) ?.let { publishedPost -> - if (postsRepo.deletePost(postId)) { - _postingTriggeredFlow.emit(post) - postId - } else { - publishedPostsRepo.unpublishPost(publishedPost.id) - null - } + publishedPostsRepo.create(post).firstOrNull() ?.also { + _postingTriggeredFlow.emit(it) } - } + } ?.id } } diff --git a/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/repos/PublishedPostsRepo.kt b/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/repos/PublishedPostsRepo.kt index a4d51998..4f7e6bb4 100644 --- a/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/repos/PublishedPostsRepo.kt +++ b/publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/repos/PublishedPostsRepo.kt @@ -1,36 +1,40 @@ package dev.inmo.postssystem.core.publishing.repos +import com.soywiz.klock.DateTime +import dev.inmo.micro_utils.pagination.* +import dev.inmo.micro_utils.repos.* +import dev.inmo.postssystem.core.UnixMillis import dev.inmo.postssystem.core.post.PostId import dev.inmo.postssystem.core.post.RegisteredPost import dev.inmo.postssystem.core.post.repo.PostsRepo -import dev.inmo.postssystem.core.post.repo.ReadPostsRepo import kotlinx.coroutines.flow.Flow +import kotlinx.serialization.Serializable +import kotlinx.serialization.Transient -interface PublishedPostsReadRepo : ReadPostsRepo -interface PublishedPostsWriteRepo { - val postPublishedFlow: Flow - val postUnpublishedFlow: Flow - - suspend fun registerPublishedPost(registeredPost: RegisteredPost): RegisteredPost? - suspend fun unpublishPost(postId: PostId): Boolean? +typealias PublishedPostId = String +@Serializable +data class PublishedPost( + val id: PublishedPostId, + val post: RegisteredPost, + private val publicationTime: UnixMillis +) { + @Transient + val publicationDateTime = DateTime(publicationTime) } -interface PublishedPostsRepo : PublishedPostsReadRepo, PublishedPostsWriteRepo - -class BusinessPublishedPostsRepo( - private val realPostsRepoWithPublishedPosts: PostsRepo -) : PublishedPostsRepo, ReadPostsRepo by realPostsRepoWithPublishedPosts { - override val postPublishedFlow: Flow - get() = realPostsRepoWithPublishedPosts.postCreatedFlow - override val postUnpublishedFlow: Flow - get() = realPostsRepoWithPublishedPosts.postDeletedFlow - - override suspend fun registerPublishedPost( - registeredPost: RegisteredPost - ): RegisteredPost? = realPostsRepoWithPublishedPosts.createPost(registeredPost) - - override suspend fun unpublishPost( - postId: PostId - ): Boolean? = realPostsRepoWithPublishedPosts.deletePost(postId) - +interface PublishedPostsReadRepo : ReadCRUDRepo { + suspend fun getPostPublishing( + postId: PostId, + pagination: Pagination, + reversed: Boolean = false + ): PaginationResult } +suspend inline fun PostId.isPublished(lookIn: PublishedPostsReadRepo): Boolean { + return lookIn.getPostPublishing(this, FirstPagePagination(1)).results.isNotEmpty() +} +suspend inline fun RegisteredPost.isPublished(lookIn: PublishedPostsReadRepo): Boolean { + return lookIn.getPostPublishing(id, FirstPagePagination(1)).results.isNotEmpty() +} +interface PublishedPostsWriteRepo : WriteCRUDRepo + +interface PublishedPostsRepo : PublishedPostsReadRepo, PublishedPostsWriteRepo, CRUDRepo diff --git a/publishing/exposed/src/jvmMain/kotlin/dev/inmo/postssystem/core/publishing/exposed/ExposedPublishedPostsRepo.kt b/publishing/exposed/src/jvmMain/kotlin/dev/inmo/postssystem/core/publishing/exposed/ExposedPublishedPostsRepo.kt new file mode 100644 index 00000000..ee4bd794 --- /dev/null +++ b/publishing/exposed/src/jvmMain/kotlin/dev/inmo/postssystem/core/publishing/exposed/ExposedPublishedPostsRepo.kt @@ -0,0 +1,81 @@ +package dev.inmo.postssystem.core.publishing.exposed + +import com.soywiz.klock.DateTime +import dev.inmo.micro_utils.coroutines.launchSynchronously +import dev.inmo.micro_utils.pagination.* +import dev.inmo.micro_utils.pagination.utils.reverse +import dev.inmo.micro_utils.repos.exposed.AbstractExposedCRUDRepo +import dev.inmo.micro_utils.repos.exposed.initTable +import dev.inmo.postssystem.core.generateId +import dev.inmo.postssystem.core.post.PostId +import dev.inmo.postssystem.core.post.RegisteredPost +import dev.inmo.postssystem.core.post.repo.ReadPostsRepo +import dev.inmo.postssystem.core.publishing.repos.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import org.jetbrains.exposed.sql.* +import org.jetbrains.exposed.sql.statements.InsertStatement +import org.jetbrains.exposed.sql.statements.UpdateStatement +import org.jetbrains.exposed.sql.transactions.transaction + +class ExposedPublishedPostsRepo( + override val database: Database, + private val postsRepo: ReadPostsRepo, + tableName: String = "PublishedPostsRepo", + private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default) +) : PublishedPostsRepo, + AbstractExposedCRUDRepo( + tableName = tableName + ) { + private val idColumn = text("id") + private val postIdColumn = text("postId") + private val dateTimeColumn = double("dateTime").clientDefault { + DateTime.now().unixMillis + } + + override val selectByIds: SqlExpressionBuilder.(List) -> Op = { idColumn.inList(it) } + override val InsertStatement.asObject: PublishedPost get() = TODO() + + override fun InsertStatement.asObject(value: RegisteredPost): PublishedPost = PublishedPost( + get(idColumn), + value, + get(dateTimeColumn) + ) + + override val selectById: SqlExpressionBuilder.(PublishedPostId) -> Op = { idColumn.eq(it) } + override val ResultRow.asObject: PublishedPost + get() = PublishedPost( + get(idColumn), + requireNotNull(launchSynchronously(scope) { postsRepo.getPostById(get(postIdColumn)) }) { "Post with id \"${get(postIdColumn)}\" not found" }, + get(dateTimeColumn) + ) + + init { + initTable() + } + + override fun insert(value: RegisteredPost, it: InsertStatement) { + it[idColumn] = generateId() + it[postIdColumn] = value.id + } + + override fun update(id: PublishedPostId, value: RegisteredPost, it: UpdateStatement) { + it[postIdColumn] = value.id + } + + override suspend fun getPostPublishing( + postId: PostId, + pagination: Pagination, + reversed: Boolean + ): PaginationResult = transaction(database) { + val query = select { postIdColumn.eq(postId) } + query.paginate(pagination, postIdColumn, reversed).map { + it[idColumn] + } to query.count() + }.let { (results, count) -> + results.createPaginationResult( + if (reversed) pagination.reverse(count) else pagination, + count + ) + } +} \ No newline at end of file