Manage distribution board components
This commit is contained in:
parent
31589875b5
commit
756e307bd8
9 changed files with 877 additions and 8 deletions
|
|
@ -52,6 +52,9 @@ import type {
|
|||
import type {
|
||||
CircuitSectionRenumberAssignment,
|
||||
} from "../../domain/models/circuit-section-renumber-project-command.model";
|
||||
import type {
|
||||
DistributionBoardComponentSnapshot,
|
||||
} from "../../domain/models/distribution-board-component-structure-project-command.model";
|
||||
|
||||
async function request<T>(url: string, init?: RequestInit): Promise<T> {
|
||||
const response = await fetch(url, {
|
||||
|
|
@ -320,6 +323,58 @@ export function getCircuitTree(projectId: string, circuitListId: string) {
|
|||
return request<CircuitTreeResponseDto>(`/api/projects/${projectId}/circuit-lists/${circuitListId}/tree`);
|
||||
}
|
||||
|
||||
export function insertDistributionBoardComponentCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
snapshot: DistributionBoardComponentSnapshot
|
||||
) {
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "distribution-board-component.insert",
|
||||
payload: { snapshot },
|
||||
},
|
||||
"Verteilerkomponente hinzufügen"
|
||||
);
|
||||
}
|
||||
|
||||
export function updateDistributionBoardComponentCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
expected: DistributionBoardComponentSnapshot,
|
||||
target: DistributionBoardComponentSnapshot
|
||||
) {
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "distribution-board-component.update",
|
||||
payload: { expected, target },
|
||||
},
|
||||
"Verteilerkomponente bearbeiten"
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteDistributionBoardComponentCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
snapshot: DistributionBoardComponentSnapshot
|
||||
) {
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "distribution-board-component.delete",
|
||||
payload: { snapshot },
|
||||
},
|
||||
"Verteilerkomponente entfernen"
|
||||
);
|
||||
}
|
||||
|
||||
export function updateCircuitById(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue