ExposedPostsRepo now using post also as RegisteredContent (if is)

This commit is contained in:
2020-08-15 14:34:27 +06:00
parent 277d978f9e
commit dbf8e3716c
3 changed files with 12 additions and 8 deletions
core
api
src
commonMain
kotlin
com
insanusmokrassar
postssystem
core
exposed
src
main
kotlin
com
insanusmokrassar
postssystem
publishing/api/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/publishing

@ -31,12 +31,14 @@ class BusinessPublishingTrigger(
publishingKeysRepo.unsetPostTriggerControlKey(postId)
return postsRepo.getPostById(postId) ?.let { post ->
if (postsRepo.deletePost(postId)) {
publishedPostsRepo.createPost(post)
postingTriggeredChannel.send(post)
postId
} else {
null
publishedPostsRepo.createPost(post) ?.let { publishedPost ->
if (postsRepo.deletePost(postId)) {
postingTriggeredChannel.send(post)
postId
} else {
publishedPostsRepo.deletePost(publishedPost.id)
null
}
}
}
}