Add weather summary

This commit is contained in:
2024-03-04 01:49:28 +00:00
parent 4aaa9064fb
commit d396ec785f
5 changed files with 197 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import WeatherUpdate from '@/models/weather/weather-update';
import WeatherRecent from '@/models/weather/weather-recent';
import WeatherValueType from '@/models/weather/weather-value-type';
import WeatherValueGrouped from '@/models/weather/weather-value-grouped';
import { WeatherAggregates } from '@/models/weather/weather-aggregates';
export const useWeatherStore = defineStore('weather', {
state: () => {
@@ -62,6 +63,20 @@ export const useWeatherStore = defineStore('weather', {
`/api/weather/readings/value-history-grouped?weatherValueType=${valueType}&start=${startString}&end=${endString}&bucketMinutes=${bucketMinutes}`
);
return response.data;
},
async getReadingAggregate(
start: Date,
end: Date
): Promise<WeatherAggregates | undefined> {
const startString = start.toISOString();
const endString = end.toISOString();
const response = await axios.get<WeatherAggregates>(
Environment.getUrlPrefix() +
`/api/weather/readings/aggregate?start=${startString}&end=${endString}`
);
return response.data;
}
}