Limit all dates asking to 3 months range
This commit is contained in:
@@ -6,7 +6,7 @@ import com.comcast.ip4s.IpLiteralSyntax
|
||||
import db.DataService
|
||||
import fetch.FetchService
|
||||
import parse.{Aggregate, Parser, WeatherData}
|
||||
import server.ValidateRoutes.{AggKey, CityList, DateTimeRange, Granularity, ValidDate}
|
||||
import server.ValidateRoutes.{AggKey, CityList, DateTimeRange, Granularity, ValidDate, ValidateMonths}
|
||||
import io.circe.{Json, Printer}
|
||||
import org.http4s._
|
||||
import org.http4s.dsl.io._
|
||||
@@ -89,6 +89,12 @@ class Server(dataService: DataService, fetch: FetchService, log: Logger[IO]) {
|
||||
Ok(dates.asJson.pretty)
|
||||
)
|
||||
|
||||
// http://0.0.0.0:8080/api/show/months/202304,202305,202306
|
||||
case GET -> Root / "show" / "months" / ValidateMonths(monthList) =>
|
||||
dataService.getDatesByMonths(monthList).flatMap(dates =>
|
||||
Ok(dates.asJson.pretty)
|
||||
)
|
||||
|
||||
// http://0.0.0.0:8080/api/show/date/20230423
|
||||
case GET -> Root / "show" / "date" / ValidDate(date) =>
|
||||
dataService.getDateFileNames(date).flatMap(fileNames =>
|
||||
|
||||
Reference in New Issue
Block a user