fix(roads): split parameterized queries into individual statements to satisfy node-postgres prepared statement rule

This commit is contained in:
Hamza-Ayed
2026-08-19 16:46:59 +03:00
parent 06895d6720
commit 52a912380f
@@ -228,14 +228,14 @@ export class RoadRefinementController {
`);
// 2. Direct insert into approved_roads immediately (Delete existing first to ensure idempotency)
await this.dataSource.query(`DELETE FROM approved_roads WHERE candidate_id = $1::uuid`, [id]);
await this.dataSource.query(`
DELETE FROM approved_roads WHERE candidate_id = $1::uuid;
INSERT INTO approved_roads (
candidate_id, geometry, name, highway, confidence, "uniqueDriverCount", oneway, approved_at
)
SELECT
id, geometry::geometry, COALESCE(name, 'Unnamed Road'), COALESCE(highway, 'residential'), confidence, "uniqueDriverCount", COALESCE(oneway, 0), NOW()
FROM candidate_roads WHERE id = $1::uuid;
FROM candidate_roads WHERE id = $1::uuid
`, [id]);
// 3. Mark candidate as approved