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