add pagination and device id query
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-08-17 16:16:37 +02:00
parent 430b4b756e
commit f2ab81e0f4
3 changed files with 33 additions and 0 deletions

View File

@@ -25,6 +25,22 @@ class SampleServiceServer {
call.respond(sampleObjectService.getAllSampleObjects())
}
get("/sample/count") {
call.respond(sampleObjectService.getCount())
}
get("/sample/page/{page}") {
val page = call.parameters["page"] ?: error(HttpStatusCode.NotAcceptable)
val pageNum = page.toLong()
call.respond(sampleObjectService.getPage(pageNum))
}
get("/sample/device/{device_id}") {
val deviceId = call.parameters["device_id"] ?: error(HttpStatusCode.NotAcceptable)
val deviceIdNum = deviceId.toInt()
call.respond(sampleObjectService.getSampleObjectbyDeviceID(deviceIdNum))
}
get("/sample/after/{dateAfter}") {
val dateAfter = call.parameters["dateAfter"] ?: error(HttpStatusCode.NotAcceptable)
val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE