Query and display weather data for all country

This commit is contained in:
Guntis Smaukstelis
2023-12-24 23:54:16 +02:00
parent 7305718c34
commit a48b9df91f
35 changed files with 193 additions and 63 deletions
@@ -2,6 +2,7 @@ package server
import cats.data.NonEmptyList
import parse.Aggregate.AggregateKey
import parse.WeatherData
import java.time.{LocalDate, LocalDateTime}
import java.time.format.DateTimeFormatter
@@ -56,6 +57,14 @@ object ValidateRoutes {
}
}
object AggFieldList {
def unapply(str: String): Option[NonEmptyList[String]] = {
val weatherFields = WeatherData.getKeys
val filteredList = str.split(",").toList.filter(weatherFields.contains)
NonEmptyList.fromList(filteredList)
}
}
object AggKey {
def unapply(str: String): Option[AggregateKey] = {
AggregateKey.fromString(str)