Tag operation result rows with pf_note and pf_op
Forecast tables don't carry pf_note; it's joined from pf.log on /data fetch. RETURNING * from scale/recode/clone INSERTs lacks those fields, so rows appended via table.update arrived with pf_note null until a reload re-ran the join. Inject pf_note and pf_op server-side from the request before responding. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
8492557621
commit
15ab5a3a13
@ -254,7 +254,8 @@ module.exports = function(pool) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = await runSQL(sql);
|
const result = await runSQL(sql);
|
||||||
res.json({ rows: result.rows, rows_affected: result.rows.length });
|
const rows = result.rows.map(r => ({ ...r, pf_note: note || null, pf_op: 'scale' }));
|
||||||
|
res.json({ rows, rows_affected: rows.length });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.status(err.status || 500).json({ error: err.message });
|
res.status(err.status || 500).json({ error: err.message });
|
||||||
@ -289,7 +290,8 @@ module.exports = function(pool) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = await runSQL(sql);
|
const result = await runSQL(sql);
|
||||||
res.json({ rows: result.rows, rows_affected: result.rows.length });
|
const rows = result.rows.map(r => ({ ...r, pf_note: note || null, pf_op: 'recode' }));
|
||||||
|
res.json({ rows, rows_affected: rows.length });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.status(err.status || 500).json({ error: err.message });
|
res.status(err.status || 500).json({ error: err.message });
|
||||||
@ -326,7 +328,8 @@ module.exports = function(pool) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = await runSQL(sql);
|
const result = await runSQL(sql);
|
||||||
res.json({ rows: result.rows, rows_affected: result.rows.length });
|
const rows = result.rows.map(r => ({ ...r, pf_note: note || null, pf_op: 'clone' }));
|
||||||
|
res.json({ rows, rows_affected: rows.length });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.status(err.status || 500).json({ error: err.message });
|
res.status(err.status || 500).json({ error: err.message });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user