Manage circuit groups
This commit is contained in:
@@ -55,6 +55,9 @@ import type {
|
||||
import type {
|
||||
DistributionBoardComponentSnapshot,
|
||||
} from "../../domain/models/distribution-board-component-structure-project-command.model";
|
||||
import type {
|
||||
CircuitGroupSnapshot,
|
||||
} from "../../domain/models/circuit-group-structure-project-command.model";
|
||||
|
||||
async function request<T>(url: string, init?: RequestInit): Promise<T> {
|
||||
const response = await fetch(url, {
|
||||
@@ -375,6 +378,58 @@ export function deleteDistributionBoardComponentCommand(
|
||||
);
|
||||
}
|
||||
|
||||
export function insertCircuitGroupCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
snapshot: CircuitGroupSnapshot
|
||||
) {
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "circuit-group.insert",
|
||||
payload: { snapshot },
|
||||
},
|
||||
"Stromkreisgruppe hinzufügen"
|
||||
);
|
||||
}
|
||||
|
||||
export function updateCircuitGroupCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
expected: CircuitGroupSnapshot,
|
||||
target: CircuitGroupSnapshot
|
||||
) {
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "circuit-group.update",
|
||||
payload: { expected, target },
|
||||
},
|
||||
"Stromkreisgruppe bearbeiten"
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteCircuitGroupCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
snapshot: CircuitGroupSnapshot
|
||||
) {
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "circuit-group.delete",
|
||||
payload: { snapshot },
|
||||
},
|
||||
"Leere Stromkreisgruppe entfernen"
|
||||
);
|
||||
}
|
||||
|
||||
export function updateCircuitById(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
|
||||
Reference in New Issue
Block a user