forked from jappel/leistungsbilanz-ts
Protect referenced feeder structures from deletion
This commit is contained in:
parent
b893c72534
commit
855a04e655
13 changed files with 369 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ import {
|
|||
toCircuitDeviceRowSnapshot,
|
||||
} from "./circuit-device-row-structure.persistence.js";
|
||||
import { executeProjectCommandTransaction } from "./project-command-transaction.persistence.js";
|
||||
import { assertCircuitsAreNotReferencedAsFeeders } from "./distribution-board-feeding-deletion-guard.persistence.js";
|
||||
import { resolveCircuitVoltage } from "./project-voltage.persistence.js";
|
||||
import { assertEquipmentIdentifierAvailable } from "./equipment-identifier-uniqueness.persistence.js";
|
||||
|
||||
|
|
@ -236,6 +237,8 @@ export class CircuitStructureProjectCommandRepository
|
|||
protectionDevice: protectionDevice ?? null,
|
||||
});
|
||||
|
||||
assertCircuitsAreNotReferencedAsFeeders(database, projectId, [circuit.id]);
|
||||
|
||||
const result = database
|
||||
.delete(circuits)
|
||||
.where(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue