GET /version endpoint
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
package com.jaytux.simd.server
|
||||
|
||||
import com.jaytux.simd.data.*
|
||||
import io.ktor.http.content.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
|
||||
@ -37,6 +40,11 @@ data class IntrinsicDetails(
|
||||
val performance: List<PlatformPerformance>?
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Versioning(
|
||||
val intelVersion: String, val intelUpdate: LocalDate, val scrapeDate: LocalDate
|
||||
)
|
||||
|
||||
fun Routing.installGetAll() {
|
||||
getPagedUrl("/all", { 100 }, { IntrinsicSummary(it.id.value, it.mnemonic) }) {
|
||||
Intrinsic.all().orderAsc(Intrinsics.mnemonic)
|
||||
@ -125,4 +133,11 @@ fun Routing.installDetails() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Routing.installVersion() {
|
||||
get("/version") {
|
||||
val upd = Loader.DatedVersion.fromPrefs()
|
||||
call.respond(Versioning(upd.version.toString(), intelUpdate = upd.releaseDate, upd.updateDate))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user