add pagination and device id query
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user