Skip to content

Commit

Permalink
update versions of libraries and fix hanlding service
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasForst committed Mar 1, 2020
1 parent 4407893 commit 70bfaf2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
39 changes: 20 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,41 @@ repositories {
jcenter()
}

val ktorVersion: String by project
val ktoolzVersion: String by project

dependencies {
// stdlib
implementation(kotlin("stdlib-jdk8"))
// extension functions
implementation("ai.blindspot.ktoolz:ktoolz:$ktoolzVersion")
implementation("ai.blindspot.ktoolz", "ktoolz", "1.0.3")

// Ktor server dependencies
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-jackson:$ktorVersion")
implementation("io.ktor:ktor-websockets:$ktorVersion")
val ktorVersion = "1.3.0"
implementation("io.ktor", "ktor-server-core", ktorVersion)
implementation("io.ktor", "ktor-server-netty", ktorVersion)
implementation("io.ktor", "ktor-jackson", ktorVersion)
implementation("io.ktor", "ktor-websockets", ktorVersion)

// Ktor client dependencies
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-client-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-websockets:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor", "ktor-client-json", ktorVersion)
implementation("io.ktor", "ktor-client-jackson", ktorVersion)
implementation("io.ktor", "ktor-client-websockets", ktorVersion)
implementation("io.ktor", "ktor-client-cio", ktorVersion)

// logging
implementation("io.github.microutils:kotlin-logging:1.7.8")
implementation("org.slf4j:slf4j-simple:1.6.1")
implementation("io.github.microutils", "kotlin-logging", "1.7.8")
implementation("org.slf4j", "slf4j-simple", "1.6.1")

// DI
implementation("org.kodein.di:kodein-di-generic-jvm:6.5.0")
implementation("org.kodein.di:kodein-di-framework-ktor-server-jvm:6.5.0")
val kodeinVersion = "6.5.0"
implementation("org.kodein.di", "kodein-di-generic-jvm", kodeinVersion)
implementation("org.kodein.di", "kodein-di-framework-ktor-server-jvm", kodeinVersion)

// database
implementation("org.postgresql", "postgresql", "42.2.2")
implementation("org.jetbrains.exposed", "exposed-core", "0.20.1")
implementation("org.jetbrains.exposed", "exposed-dao", "0.20.1")
implementation("org.jetbrains.exposed", "exposed-jdbc", "0.20.1")

val exposedVersion = "0.20.1"
implementation("org.jetbrains.exposed", "exposed-core", exposedVersion)
implementation("org.jetbrains.exposed", "exposed-dao", exposedVersion)
implementation("org.jetbrains.exposed", "exposed-jdbc", exposedVersion)
}

tasks {
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
kotlin.code.style=official

ktoolzVersion=1.0.1
ktorVersion=1.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class MessagesHandlingService(
}

private suspend fun handleText(token: String, message: Message) {
val userInput = UsersInput(requireNotNull(message.text) { "Text message received, text field can not be null!" })
val userInput = UsersInput(
userId = requireNotNull(message.userId) { "User ID must be specified for the text message." },
input = requireNotNull(message.text) { "Text message received, text field can not be null!" }
)
with(userInput.input) {
when {
startsWith("/poll") -> pollService.createPoll(token, userInput)
Expand Down

0 comments on commit 70bfaf2

Please sign in to comment.