Fix variants query by removing non-existent fid column
Deploy TrassenPlaner / deploy (push) Waiting to run Details

This commit is contained in:
Johannes Baumeister 2026-04-20 10:15:59 +02:00
parent 945b01b8f4
commit 1185a5b5e0
1 changed files with 3 additions and 3 deletions

View File

@ -187,7 +187,7 @@ app.get('/api/variants', async (req, res) => {
await setSchema(client); await setSchema(client);
const query = ` const query = `
SELECT SELECT
COALESCE(id, fid) AS id, name, "Variante", id, name, "Variante",
ST_AsGeoJSON(ST_Transform(geom, 4326)) as geometry ST_AsGeoJSON(ST_Transform(geom, 4326)) as geometry
FROM kabeltrasse FROM kabeltrasse
ORDER BY id DESC ORDER BY id DESC
@ -222,7 +222,7 @@ app.post('/api/variants', async (req, res) => {
const client = await pool.connect(); const client = await pool.connect();
try { try {
await setSchema(client); await setSchema(client);
const routeName = properties.name || 'Neue Trasse'; const routeName = properties.name || 'Neue Trasse';
const varianteValue = properties.Variante || (properties.name ? properties.name.replace('Variante ', '') : 'A'); const varianteValue = properties.Variante || (properties.name ? properties.name.replace('Variante ', '') : 'A');
const geoJsonStr = JSON.stringify(geometry); const geoJsonStr = JSON.stringify(geometry);
@ -239,7 +239,7 @@ app.post('/api/variants', async (req, res) => {
) )
RETURNING id RETURNING id
`; `;
const insertRes = await client.query(insertQuery, [geoJsonStr, routeName, varianteValue]); const insertRes = await client.query(insertQuery, [geoJsonStr, routeName, varianteValue]);
res.json({ success: true, id: insertRes.rows[0].id }); res.json({ success: true, id: insertRes.rows[0].id });
} catch (err) { } catch (err) {