fix: Delete WEAs by both Name and UUID on Save
Deploy Standortplaner / deploy (push) Successful in 17s Details

This commit is contained in:
Johannes Baumeister 2026-07-03 09:38:06 +02:00
parent bd30641ba5
commit 60748049ea
1 changed files with 5 additions and 2 deletions

View File

@ -234,9 +234,12 @@ app.post('/api/wea', async (req, res) => {
await client.query('BEGIN');
// 1. Bestehende WEAs für dieses Projekt löschen
const projectName = await resolveProjectName(client, targetProject);
const resolvedPid = await resolveProjectId(client, targetProject);
const delRes = await client.query(
`DELETE FROM ${schema}.wea_standorte WHERE projekt_id = $1`,
[targetProject]
`DELETE FROM ${schema}.wea_standorte WHERE projekt_id = $1 OR projekt_id = $2 OR projekt_id = $3`,
[targetProject, resolvedPid, projectName]
);
log(`Gelöscht: ${delRes.rowCount} bestehende Anlagen.`);