Build fixed Faktiska production workflow
This commit is contained in:
@@ -49,6 +49,7 @@ class Server(postgresService: PostgresService, dataService: DataService, fetch:
|
||||
}
|
||||
|
||||
private case class ResponseWrapper(result: Map[String, Option[Aggregate.AggregateValue]], query: UserQuery)
|
||||
private case class LatestTemperature(city: String, observedAt: String, value: Option[Double])
|
||||
|
||||
private val apiRoutes = HttpRoutes.of[IO] {
|
||||
// http://0.0.0.0:8080/api/show/lvgmc-forecast/Latvija_LTV_pilsetas_tekosa_dn.csv
|
||||
@@ -127,6 +128,12 @@ class Server(postgresService: PostgresService, dataService: DataService, fetch:
|
||||
.map(result => ResponseWrapper(result, userQuery))
|
||||
.flatMap(responseWrapper => Ok(responseWrapper.asJson.pretty))
|
||||
|
||||
// Latest observation-time temperatures for a fixed production station set.
|
||||
case GET -> Root / "query" / "latest-temperatures" / CityList(cities) =>
|
||||
postgresService.queryLatestTemperatures(cities)
|
||||
.map(_.map { case (city, observedAt, value) => LatestTemperature(city, observedAt.toString, value) })
|
||||
.flatMap(result => Ok(result.asJson.pretty))
|
||||
|
||||
// http://0.0.0.0:8080/api/query/city/Kolka/20230414_2200-20230501_1230/allFields
|
||||
case GET -> Root / "query" / "city" / (city: String) / DateTimeRange(from, to) / "allFields" =>
|
||||
postgresService.queryCityAllFields(city, from, to).flatMap(result => Ok(result.asJson))
|
||||
|
||||
Reference in New Issue
Block a user