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