just commit

This commit is contained in:
2020-07-30 15:28:11 +06:00
parent 981a354441
commit 3795b85827
29 changed files with 429 additions and 47 deletions

View File

@@ -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')
}
}
}

View File

@@ -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 {

View File

@@ -19,7 +19,7 @@ interface WritePublishingKeysRepo {
): Boolean
suspend fun unsetPostTriggerControlKey(
postId: PostId
)
): Boolean
}
interface PublishingKeysRepo : ReadPublishingKeysRepo, WritePublishingKeysRepo