This commit is contained in:
parent
02793fa806
commit
b0fadd63d6
@ -6,9 +6,8 @@ import io.ktor.http.HttpStatusCode
|
|||||||
import io.ktor.response.respond
|
import io.ktor.response.respond
|
||||||
import io.ktor.routing.Routing
|
import io.ktor.routing.Routing
|
||||||
import io.ktor.routing.get
|
import io.ktor.routing.get
|
||||||
|
import kotlinx.datetime.LocalDateTime
|
||||||
import org.koin.ktor.ext.inject
|
import org.koin.ktor.ext.inject
|
||||||
import java.time.LocalDate
|
|
||||||
import java.time.format.DateTimeFormatter
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sample Service
|
* Sample Service
|
||||||
@ -43,8 +42,7 @@ class SampleServiceServer {
|
|||||||
|
|
||||||
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 localDateAfter : LocalDateTime = LocalDateTime.parse(dateAfter)
|
||||||
val localDateAfter : LocalDate = LocalDate.parse(dateAfter,dateTimeFormatter)
|
|
||||||
val resultList = sampleObjectService.getSampleObjectafterDate(localDateAfter)
|
val resultList = sampleObjectService.getSampleObjectafterDate(localDateAfter)
|
||||||
|
|
||||||
call.respond(resultList)
|
call.respond(resultList)
|
||||||
@ -52,8 +50,7 @@ class SampleServiceServer {
|
|||||||
|
|
||||||
get("/sample/before/{dateBefore}") {
|
get("/sample/before/{dateBefore}") {
|
||||||
val dateAfter = call.parameters["dateBefore"] ?: error(HttpStatusCode.NotAcceptable)
|
val dateAfter = call.parameters["dateBefore"] ?: error(HttpStatusCode.NotAcceptable)
|
||||||
val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE
|
val localDateBefore : LocalDateTime = LocalDateTime.parse(dateAfter)
|
||||||
val localDateBefore : LocalDate = LocalDate.parse(dateAfter,dateTimeFormatter)
|
|
||||||
val resultList = sampleObjectService.getSampleObjectbeforeDate(localDateBefore)
|
val resultList = sampleObjectService.getSampleObjectbeforeDate(localDateBefore)
|
||||||
|
|
||||||
call.respond(resultList)
|
call.respond(resultList)
|
||||||
|
Loading…
Reference in New Issue
Block a user