Rest api for deleting old forecasts

This commit is contained in:
Guntis Smaukstelis
2025-03-05 23:25:42 +02:00
parent 07df4d2cde
commit e9408391ac
3 changed files with 22 additions and 6 deletions
+3 -1
View File
@@ -24,7 +24,6 @@ import parse.csv.Aggregate.{AggregateKey, UserQuery}
import org.http4s.circe.jsonEncoder
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger
import fs2.io.file.Path
import parse.csv.Aggregate
import scala.concurrent.duration.DurationInt
@@ -68,6 +67,9 @@ class Server(postgresService: PostgresService, dataService: DataService, fetch:
case GET -> Root / "grib" / "binary-chunk" / ValidateInt(binaryOffset) / ValidateInt(binaryLength) / fileName =>
dataService.getBinaryChunk(binaryOffset, binaryLength, fileName).flatMap(buffer => Ok(buffer))
// http://0.0.0.0:8080/api/grib/delete-old-forecasts
case GET -> Root / "grib" / "delete-old-forecasts" =>
dataService.deleteOldForecasts().flatMap(result => Ok(result.asJson))