Fix variants query by removing non-existent fid column
Deploy TrassenPlaner / deploy (push) Waiting to run
Details
Deploy TrassenPlaner / deploy (push) Waiting to run
Details
This commit is contained in:
parent
945b01b8f4
commit
1185a5b5e0
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue