just commit
This commit is contained in:
@@ -41,7 +41,7 @@ kotlin {
|
||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||
api "com.insanusmokrassar:postssystem.core:$core_version"
|
||||
} else {
|
||||
implementation project(":postssystem.core")
|
||||
api project(":postssystem.core")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,8 @@ kotlin {
|
||||
}
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit-js')
|
||||
implementation kotlin('test-js')
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package com.insanusmokrassar.postssystem.core.publishing
|
||||
|
||||
import com.insanusmokrassar.postssystem.core.post.PostId
|
||||
import com.insanusmokrassar.postssystem.core.post.RegisteredPost
|
||||
import com.insanusmokrassar.postssystem.core.post.api.PostsAPI
|
||||
import com.insanusmokrassar.postssystem.core.post.repo.PostsRepo
|
||||
import com.insanusmokrassar.postssystem.core.publishing.repos.PublishingKeysRepo
|
||||
import kotlinx.coroutines.channels.BroadcastChannel
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
@@ -17,7 +17,7 @@ interface PublishingTrigger {
|
||||
}
|
||||
|
||||
class BusinessPublishingTrigger(
|
||||
private val postsAPI: PostsAPI,
|
||||
private val postsRepo: PostsRepo,
|
||||
private val publishingKeysRepo: PublishingKeysRepo
|
||||
) : PublishingTrigger {
|
||||
private val postingTriggeredChannel: BroadcastChannel<RegisteredPost> = BroadcastChannel(Channel.BUFFERED)
|
||||
@@ -27,8 +27,8 @@ class BusinessPublishingTrigger(
|
||||
val postId = publishingKeysRepo.getPostIdByTriggerControlKey(triggerControlKey) ?: return null
|
||||
publishingKeysRepo.unsetPostTriggerControlKey(postId)
|
||||
|
||||
return postsAPI.getPostById(postId) ?.let { post ->
|
||||
if (postsAPI.deletePost(postId)) {
|
||||
return postsRepo.getPostById(postId) ?.let { post ->
|
||||
if (postsRepo.deletePost(postId)) {
|
||||
postingTriggeredChannel.send(post)
|
||||
postId
|
||||
} else {
|
||||
|
@@ -19,7 +19,7 @@ interface WritePublishingKeysRepo {
|
||||
): Boolean
|
||||
suspend fun unsetPostTriggerControlKey(
|
||||
postId: PostId
|
||||
)
|
||||
): Boolean
|
||||
}
|
||||
|
||||
interface PublishingKeysRepo : ReadPublishingKeysRepo, WritePublishingKeysRepo
|
||||
|
Reference in New Issue
Block a user