pavelfilippi / weather-monitor

MIT License
1 stars 0 forks source link

Setup filtration based on time #19

Closed pavelfilippi closed 1 year ago

pavelfilippi commented 1 year ago

Implements filtering weather conditions

Users can filter weather conditions based on time filters time_from & time_to.

Changes

Example usage

query stationConditions {
  weatherData {
    time
    resourceId
    temperature
    humidity
    pressure
    batteryPercentage
  }
}

{
  "data": {
    "weatherData": [
      {
        "time": "2022-11-24T16:01:37.123000",
        "resourceId": 2,
        "temperature": 0,
        "humidity": 0,
        "pressure": 0,
        "batteryPercentage": 0
      },
      {
        "time": "2022-11-25T17:01:37.123000",
        "resourceId": 2,
        "temperature": 0,
        "humidity": 0,
        "pressure": 0,
        "batteryPercentage": 0
      },
      {
        "time": "2022-11-23T11:01:37.123000",
        "resourceId": 2,
        "temperature": 0,
        "humidity": 0,
        "pressure": 0,
        "batteryPercentage": 0
      }
    ]
  }
}
query stationConditions {
  weatherData(
    timeFilter: {
      timeTo: "2022-11-24 17:01:37.123",
      }
  ) {
    time
    resourceId
    temperature
    humidity
    pressure
    batteryPercentage
  }
}

{
  "data": {
    "weatherData": [
      {
        "time": "2022-11-24T16:01:37.123000",
        "resourceId": 2,
        "temperature": 0,
        "humidity": 0,
        "pressure": 0,
        "batteryPercentage": 0
      },
      {
        "time": "2022-11-23T11:01:37.123000",
        "resourceId": 2,
        "temperature": 0,
        "humidity": 0,
        "pressure": 0,
        "batteryPercentage": 0
      }
    ]
  }
}  
query stationConditions {
  weatherData(
    timeFilter: {
      timeTo: "2022-11-24 17:01:37.123",
      timeFrom: "2022-11-24T16:01:37.123000"}
  ) {
    time
    resourceId
    temperature
    humidity
    pressure
    batteryPercentage
  }
}

{
  "data": {
    "weatherData": [
      {
        "time": "2022-11-24T16:01:37.123000",
        "resourceId": 2,
        "temperature": 0,
        "humidity": 0,
        "pressure": 0,
        "batteryPercentage": 0
      }
    ]
  }
}