Pass coordinates back

This commit is contained in:
2026-06-21 23:20:36 -04:00
parent 451809b7cc
commit 2c8666db56

View File

@@ -55,7 +55,9 @@ app.get('/api/data', async (req, res) => {
const celestial = getCelestialCurrent(coords.lat, coords.lon) const celestial = getCelestialCurrent(coords.lat, coords.lon)
const data = { const data = {
...coords, gps_lat: coords.lat,
gps_lon: coords.lon,
gps_alt: coords.alt,
...(sensor.status === 'fulfilled' ? sensor.value : {}), ...(sensor.status === 'fulfilled' ? sensor.value : {}),
...celestial, ...celestial,
...(space.status === 'fulfilled' ? space.value : {}), ...(space.status === 'fulfilled' ? space.value : {}),
@@ -86,7 +88,7 @@ app.get('/api/hourly', async (req, res) => {
// Spread space weather into every hourly row // Spread space weather into every hourly row
const result = mergeRows([sensorRows, meteoHourly, celestial]) const result = mergeRows([sensorRows, meteoHourly, celestial])
.map(row => ({ ...coords, ...spaceData, ...row })) .map(row => ({ gps_lat: coords.lat, gps_lon: coords.lon, gps_alt: coords.alt, ...spaceData, ...row }))
res.json(filterArr(result, fields)) res.json(filterArr(result, fields))
}) })
@@ -112,7 +114,7 @@ app.get('/api/daily', async (req, res) => {
const celestial = getCelestialDaily(coords.lat, coords.lon, seedRows) const celestial = getCelestialDaily(coords.lat, coords.lon, seedRows)
const result = mergeRows([sensorRows, meteoDaily, celestial]) const result = mergeRows([sensorRows, meteoDaily, celestial])
.map(row => ({ ...coords, ...spaceData, ...row })) .map(row => ({ location: coords,gps_lat: coords.lat, gps_lon: coords.lon, gps_alt: coords.alt, ...spaceData, ...row }))
res.json(filterArr(result, fields)) res.json(filterArr(result, fields))
}) })