update more things
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-08-11 16:50:34 +02:00
parent 9cfaf5857b
commit 7edc69ec2e
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
7 changed files with 13 additions and 12 deletions

View File

@ -1,5 +1,5 @@
ktor_version=1.6.2
kotlin.code.style=official
kotlin_version=1.4.10
logback_version=1.2.1
koin_version=2.2.0
kotlin_version=1.5.21
logback_version=1.2.5
koin_version=2.2.2

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

View File

@ -11,10 +11,10 @@ import io.ktor.features.*
import org.apache.http.HttpException
import com.kmalbz.database.DatabaseFactory
import com.kmalbz.database.dao.SampleObjects
import io.ktor.util.KtorExperimentalAPI
import com.rabbitmq.client.*
import com.typesafe.config.ConfigFactory
import io.ktor.config.HoconApplicationConfig
import io.ktor.util.*
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.transactions.transaction
import org.koin.ktor.ext.Koin

View File

@ -7,7 +7,9 @@ import com.rabbitmq.client.AMQP.BasicProperties
import com.rabbitmq.client.Consumer
import com.rabbitmq.client.Envelope
import com.rabbitmq.client.ShutdownSignalException
import io.ktor.util.*
@KtorExperimentalAPI
class DatabaseConsumer : Consumer {
private val sampleObjectService = SampleObjectService()

View File

@ -3,29 +3,24 @@ package com.kmalbz.database
import com.typesafe.config.ConfigFactory
import com.zaxxer.hikari.*
import io.ktor.config.HoconApplicationConfig
import io.ktor.util.KtorExperimentalAPI
import io.ktor.util.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
@KtorExperimentalAPI
object DatabaseFactory {
@KtorExperimentalAPI
private val appConfig = HoconApplicationConfig(ConfigFactory.load())
@KtorExperimentalAPI
private val dbUrl = appConfig.property("ktor.db.jdbc").getString()
@KtorExperimentalAPI
private val dbUser = appConfig.property("ktor.db.user").getString()
@KtorExperimentalAPI
private val dbPassword = appConfig.property("ktor.db.password").getString()
@KtorExperimentalAPI
fun init() {
Database.connect(hikari())
}
@KtorExperimentalAPI
private fun hikari(): HikariDataSource {
val config = HikariConfig()
config.driverClassName = "org.postgresql.Driver"

View File

@ -4,6 +4,7 @@ import com.kmalbz.database.DatabaseFactory.dbQuery
import com.kmalbz.database.model.SampleObject
import com.kmalbz.database.dao.SampleObjects
import com.kmalbz.api.model.ApiObject
import io.ktor.util.*
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.castTo
import org.jetbrains.exposed.sql.select
@ -12,6 +13,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
import java.time.LocalDate
@KtorExperimentalAPI
class SampleObjectService : ISampleObjectService {
override fun addOne(apiObject: ApiObject) {

View File

@ -2,9 +2,11 @@ package com.kmalbz.di
import com.kmalbz.database.service.ISampleObjectService
import com.kmalbz.database.service.SampleObjectService
import io.ktor.util.*
import org.koin.dsl.module
import org.koin.experimental.builder.singleBy
@KtorExperimentalAPI
val injectionModule = module(createdAtStart = true) {
singleBy<ISampleObjectService,SampleObjectService>()
}