add actual drawio diagram
This commit is contained in:
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user