add post creating business case
This commit is contained in:
41
business_cases/post_creating/server/build.gradle
Normal file
41
business_cases/post_creating/server/build.gradle
Normal file
@@ -0,0 +1,41 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||
}
|
||||
|
||||
project.version = "$core_version"
|
||||
project.group = "com.insanusmokrassar"
|
||||
|
||||
apply plugin: "java-library"
|
||||
apply plugin: "kotlin"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
api projectByName("business_cases.post_creating.common")
|
||||
api projectByName("core.ktor.server")
|
||||
|
||||
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.insanusmokrassar.postssystem.business_cases.post_creating.server
|
||||
|
||||
import com.insanusmokrassar.postssystem.core.post.RegisteredPost
|
||||
import com.insanusmokrassar.postssystem.ktor.server.unianswer
|
||||
import com.insanusmokrassar.postssystem.ktor.server.uniload
|
||||
import io.ktor.application.call
|
||||
import io.ktor.routing.*
|
||||
import kotlinx.serialization.builtins.nullable
|
||||
|
||||
fun Route.configurePostCreatingRoutes(
|
||||
origin: PostCreatingCase
|
||||
) {
|
||||
route(postCreatingRootRoute) {
|
||||
post(postCreatingCreatePostRoute) {
|
||||
val model = call.uniload(PostCreatingCreatePostModel.serializer())
|
||||
|
||||
call.unianswer(
|
||||
RegisteredPost.serializer().nullable,
|
||||
origin.createPost(model.postContent, model.triggerId)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user