add actual drawio diagram

This commit is contained in:
2020-11-29 23:10:20 +06:00
parent eacd0fb9c4
commit aba2152a84
4 changed files with 8 additions and 150 deletions
Posts DB.xmindPostsSystem.drawioPostsSystemInteraction.deprecated.drawio
publishing/api/src/commonMain/kotlin/dev/inmo/postssystem/core/publishing/repos

@ -11,13 +11,19 @@ interface TriggersToPostsRepo : KeyValueRepo<PostId, TriggerId>, WriteTriggersTo
fun TriggersToPostsRepo(
keyValueRepo: KeyValueRepo<PostId, TriggerId>,
generator: PostKeyGenerator,
publishingKeyReceiverGetter: PublishingKeyReceiverGetter,
writePublishingKeysRegistrar: WritePublishingRegistrar
): TriggersToPostsRepo = object : TriggersToPostsRepo, KeyValueRepo<PostId, TriggerId> by keyValueRepo {
override suspend fun set(toSet: Map<PostId, TriggerId>) {
keyValueRepo.set(
toSet.filter { (postId, triggerId) ->
val publishingKeyReceiver = publishingKeyReceiverGetter(triggerId) ?: return@filter false
val publishingKey = generator(postId, triggerId)
writePublishingKeysRegistrar.registerTriggerForPost(publishingKey, postId)
writePublishingKeysRegistrar.registerTriggerForPost(publishingKey, postId).also {
if (it) {
publishingKeyReceiver.acceptKey(postId, publishingKey)
}
}
}
)
}