Persist complete distribution board subtrees

This commit is contained in:
Julian Appel 2026-07-31 11:57:10 +02:00
parent 13693f64b1
commit 0fd564a930
8 changed files with 789 additions and 0 deletions

View file

@ -59,6 +59,12 @@ import {
distributionBoardDeleteCommandType,
distributionBoardInsertCommandType,
} from "../models/distribution-board-structure-project-command.model.js";
import {
assertDistributionBoardDeleteSubtreeProjectCommand,
assertDistributionBoardInsertSubtreeProjectCommand,
distributionBoardDeleteSubtreeCommandType,
distributionBoardInsertSubtreeCommandType,
} from "../models/distribution-board-subtree-project-command.model.js";
import {
assertSerializedProjectCommand,
type SerializedProjectCommand,
@ -108,6 +114,7 @@ import type { CircuitGroupRenumberProjectCommandStore } from "../ports/circuit-g
import type { CircuitGroupMoveProjectCommandStore } from "../ports/circuit-group-move-project-command.store.js";
import type { CircuitGroupSubtreeProjectCommandStore } from "../ports/circuit-group-subtree-project-command.store.js";
import type { DistributionBoardStructureProjectCommandStore } from "../ports/distribution-board-structure-project-command.store.js";
import type { DistributionBoardSubtreeProjectCommandStore } from "../ports/distribution-board-subtree-project-command.store.js";
import type { DistributionBoardComponentStructureProjectCommandStore } from "../ports/distribution-board-component-structure-project-command.store.js";
import type {
ExecuteProjectHistoryCommandInput,
@ -169,6 +176,7 @@ export class ProjectCommandService implements ProjectCommandExecutor {
private readonly deviceRowMoveStore: CircuitDeviceRowMoveProjectCommandStore,
private readonly circuitStructureStore: CircuitStructureProjectCommandStore,
private readonly distributionBoardStructureStore: DistributionBoardStructureProjectCommandStore,
private readonly distributionBoardSubtreeStore: DistributionBoardSubtreeProjectCommandStore,
private readonly projectLocationStructureStore: ProjectLocationStructureProjectCommandStore,
private readonly circuitSectionReorderStore: CircuitSectionReorderProjectCommandStore,
private readonly circuitSectionRenumberStore: CircuitSectionRenumberProjectCommandStore,
@ -337,6 +345,20 @@ export class ProjectCommandService implements ProjectCommandExecutor {
command: input.command,
}).revision;
}
case distributionBoardInsertSubtreeCommandType: {
assertDistributionBoardInsertSubtreeProjectCommand(input.command);
return this.distributionBoardSubtreeStore.execute({
...input,
command: input.command,
}).revision;
}
case distributionBoardDeleteSubtreeCommandType: {
assertDistributionBoardDeleteSubtreeProjectCommand(input.command);
return this.distributionBoardSubtreeStore.execute({
...input,
command: input.command,
}).revision;
}
case distributionBoardUpdateCommandType: {
assertDistributionBoardUpdateProjectCommand(input.command);
return this.distributionBoardStructureStore.executeUpdate({