This commit is contained in:
parent
b16a5702b4
commit
5b9bb8bb82
@ -7,7 +7,6 @@ buildscript {
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "com.github.jengelman.gradle.plugins:shadow:5.2.0"
|
||||
classpath "org.koin:koin-gradle-plugin:$koin_version"
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +18,6 @@ tasks.withType(JavaCompile) {
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
apply plugin: 'application'
|
||||
apply plugin: 'koin'
|
||||
|
||||
group 'com.kmalbz'
|
||||
version '0.0.1'
|
||||
@ -49,7 +47,8 @@ dependencies {
|
||||
compile 'org.jetbrains.exposed:exposed-jdbc:0.33.1'
|
||||
compile 'org.jetbrains.exposed:exposed-java-time:0.33.1'
|
||||
compile 'com.zaxxer:HikariCP:5.0.0'
|
||||
implementation "org.koin:koin-ktor:$koin_version"
|
||||
implementation "io.insert-koin:koin-core:$koin_version"
|
||||
implementation "io.insert-koin:koin-ktor:$koin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "io.ktor:ktor-server-netty:$ktor_version"
|
||||
implementation "ch.qos.logback:logback-classic:$logback_version"
|
||||
|
@ -2,4 +2,4 @@ ktor_version=1.6.2
|
||||
kotlin.code.style=official
|
||||
kotlin_version=1.5.21
|
||||
logback_version=1.2.5
|
||||
koin_version=2.2.2
|
||||
koin_version=3.1.2
|
@ -20,16 +20,16 @@ class OutputServiceRDBServer {
|
||||
* sample
|
||||
*/
|
||||
fun Routing.registerOutput() {
|
||||
val resultObjectService by inject<ISampleObjectService>()
|
||||
val sampleObjectService:ISampleObjectService by inject()
|
||||
get("/sample"){
|
||||
call.respond(resultObjectService.getAllSampleObjects())
|
||||
call.respond(sampleObjectService.getAllSampleObjects())
|
||||
}
|
||||
|
||||
get("/sample/after/{dateAfter}") {
|
||||
val dateAfter = call.parameters["dateAfter"] ?: error(HttpStatusCode.NotAcceptable)
|
||||
val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE
|
||||
val localDateAfter : LocalDate = LocalDate.parse(dateAfter,dateTimeFormatter)
|
||||
val resultList = resultObjectService.getSampleObjectafterDate(localDateAfter)
|
||||
val resultList = sampleObjectService.getSampleObjectafterDate(localDateAfter)
|
||||
|
||||
call.respond(resultList)
|
||||
}
|
||||
@ -38,14 +38,14 @@ class OutputServiceRDBServer {
|
||||
val dateAfter = call.parameters["dateBefore"] ?: error(HttpStatusCode.NotAcceptable)
|
||||
val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE
|
||||
val localDateBefore : LocalDate = LocalDate.parse(dateAfter,dateTimeFormatter)
|
||||
val resultList = resultObjectService.getSampleObjectbeforeDate(localDateBefore)
|
||||
val resultList = sampleObjectService.getSampleObjectbeforeDate(localDateBefore)
|
||||
|
||||
call.respond(resultList)
|
||||
}
|
||||
|
||||
get("/sample/{tagID}") {
|
||||
val tagID = call.parameters["tagID"] ?: error(HttpStatusCode.NotAcceptable)
|
||||
val resultObject = resultObjectService.getSampleObjectbyTag(tagID) ?: call.respond(HttpStatusCode.NotFound)
|
||||
val resultObject = sampleObjectService.getSampleObjectbyTag(tagID) ?: call.respond(HttpStatusCode.NotFound)
|
||||
|
||||
call.respond(resultObject)
|
||||
}
|
||||
|
@ -4,9 +4,8 @@ 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>()
|
||||
single<ISampleObjectService> {SampleObjectService()}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user