forked from jappel/leistungsbilanz-ts
Derive device voltages from project settings
This commit is contained in:
parent
b1a11397b3
commit
084103bf54
39 changed files with 2696 additions and 76 deletions
|
|
@ -22,6 +22,7 @@ import {
|
|||
toCircuitDeviceRowSnapshot,
|
||||
} from "./circuit-device-row-structure.persistence.js";
|
||||
import { executeProjectCommandTransaction } from "./project-command-transaction.persistence.js";
|
||||
import { updateDerivedCircuitVoltage } from "./project-voltage.persistence.js";
|
||||
|
||||
export class CircuitDeviceRowStructureProjectCommandRepository
|
||||
implements CircuitDeviceRowStructureProjectCommandStore
|
||||
|
|
@ -101,6 +102,7 @@ export class CircuitDeviceRowStructureProjectCommandRepository
|
|||
if (circuitUpdate.changes !== 1) {
|
||||
throw new Error("Circuit changed before device-row insertion.");
|
||||
}
|
||||
updateDerivedCircuitVoltage(database, projectId, row.circuitId);
|
||||
|
||||
return createCircuitDeviceRowDeleteProjectCommand(
|
||||
row.id,
|
||||
|
|
@ -153,6 +155,11 @@ export class CircuitDeviceRowStructureProjectCommandRepository
|
|||
if (circuitUpdate.changes !== 1) {
|
||||
throw new Error("Circuit changed before device-row deletion.");
|
||||
}
|
||||
updateDerivedCircuitVoltage(
|
||||
database,
|
||||
projectId,
|
||||
expectedCircuitId
|
||||
);
|
||||
|
||||
return createCircuitDeviceRowInsertProjectCommand(
|
||||
toCircuitDeviceRowSnapshot(row)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue