get count from db layer as well
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:
parent
4f67c48f7a
commit
f46386d465
@ -29,7 +29,7 @@ class OutputServiceRDBServer {
|
||||
}
|
||||
|
||||
get("/output/count") {
|
||||
call.respond(resultObjectService.getAllResultObjects().size)
|
||||
call.respond(resultObjectService.getCount())
|
||||
}
|
||||
|
||||
get("/output/page/{page}") {
|
||||
|
@ -7,6 +7,7 @@ import java.util.*
|
||||
interface IResultObjectService{
|
||||
fun addOne(apiObject: ApiObject)
|
||||
suspend fun getAllResultObjects(): List<ApiObject>
|
||||
suspend fun getCount(): Long
|
||||
suspend fun getPage(page: Long): List<ApiObject>
|
||||
suspend fun getResultObjectbyTag(tag: String): ApiObject?
|
||||
suspend fun getResultObjectbyDate(date: LocalDate): List<ApiObject>?
|
||||
|
@ -27,6 +27,10 @@ class ResultObjectService : IResultObjectService {
|
||||
ResultObjects.selectAll().map { toResultObject(it) }
|
||||
}
|
||||
|
||||
override suspend fun getCount(): Long = dbQuery {
|
||||
ResultObjects.selectAll().count()
|
||||
}
|
||||
|
||||
override suspend fun getPage(page: Long): List<ApiObject> = dbQuery {
|
||||
ResultObjects.selectAll().limit(10,page*10).map { toResultObject(it) }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user