diff --git a/server/influx.mjs b/server/influx.mjs index 0ba5aad..fce46a2 100644 --- a/server/influx.mjs +++ b/server/influx.mjs @@ -144,5 +144,5 @@ export async function getCoords() { if (rows.length && rows[0].latitude && rows[0].longitude) { return { lat: rows[0].latitude, lon: rows[0].longitude, alt: rows[0].altitude || c.ALTITUDE } } - return { lat: c.LATITUDE, lon: c.LONGITUDE, alt: c.ALTITUDE } + return { latitude: c.LATITUDE, longitude: c.LONGITUDE, altitude: c.ALTITUDE } } diff --git a/server/server.mjs b/server/server.mjs index 5a1e2e6..ec502d4 100644 --- a/server/server.mjs +++ b/server/server.mjs @@ -69,15 +69,15 @@ app.get('/api/space', async (req, res) => { const coords = await getCoords(); if(mode === 'hourly') { const space = await getSpaceWeather(); - Object.assign(space, getCelestialHourly(coords.lat, coords.lon, start, end)); + Object.assign(space, getCelestialHourly(coords.latitude, coords.longitude, start, end)); res.json(filterFields(space, fields)); } else if(mode === 'daily') { const space = await getSpaceWeather(); - Object.assign(space, getCelestialDaily(coords.lat, coords.lon, start, end)); + Object.assign(space, getCelestialDaily(coords.latitude, coords.longitude, start, end)); res.json(filterFields(space, fields)); } else { const space = await getSpaceWeather(); - Object.assign(space, getCelestialCurrent(coords.lat, coords.lon)); + Object.assign(space, getCelestialCurrent(coords.latitude, coords.longitude)); res.json(filterFields(space, fields)); } }); @@ -92,7 +92,7 @@ app.get('/api/hourly', async (req, res) => { const coords = await getCoords(); const [sensor, meteo] = await Promise.allSettled([ queryHourly(start, now), - getOpenMeteo(coords.lat, coords.lon, now, end), + getOpenMeteo(coords.latitude, coords.longitude, now, end), ]); const history = sensor.status === 'fulfilled' ? sensor.value : []; const forecast = meteo.status === 'fulfilled' ? meteo.value.hourly : []; @@ -109,7 +109,7 @@ app.get('/api/daily', async (req, res) => { const coords = await getCoords(); const [sensor, meteo] = await Promise.allSettled([ queryDaily(start, now), - getOpenMeteo(coords.lat, coords.lon, now, end), + getOpenMeteo(coords.latitude, coords.longitude, now, end), ]); const history = sensor.status === 'fulfilled' ? sensor.value : []; const forecast = meteo.status === 'fulfilled' ? meteo.value.daily : [];