Persist section renumbering
This commit is contained in:
+18
-12
@@ -42,6 +42,9 @@ import type {
|
||||
import type {
|
||||
CircuitSectionsReorderSection,
|
||||
} from "../../domain/models/circuit-sections-reorder-project-command.model";
|
||||
import type {
|
||||
CircuitSectionRenumberAssignment,
|
||||
} from "../../domain/models/circuit-section-renumber-project-command.model";
|
||||
|
||||
async function request<T>(url: string, init?: RequestInit): Promise<T> {
|
||||
const response = await fetch(url, {
|
||||
@@ -319,12 +322,6 @@ export function moveCircuitDeviceRowsToNewCircuitCommand(
|
||||
);
|
||||
}
|
||||
|
||||
export function renumberCircuitSection(sectionId: string) {
|
||||
return request(`/api/circuit-sections/${sectionId}/renumber`, {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
export function reorderCircuitSectionCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
@@ -362,14 +359,23 @@ export function reorderCircuitSectionsCommand(
|
||||
);
|
||||
}
|
||||
|
||||
export function updateSectionEquipmentIdentifiers(
|
||||
export function renumberCircuitSectionCommand(
|
||||
projectId: string,
|
||||
expectedRevision: number,
|
||||
sectionId: string,
|
||||
identifiers: Array<{ circuitId: string; equipmentIdentifier: string }>
|
||||
assignments: CircuitSectionRenumberAssignment[],
|
||||
description: string
|
||||
) {
|
||||
return request(`/api/circuit-sections/${sectionId}/equipment-identifiers`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ identifiers }),
|
||||
});
|
||||
return executeProjectCommand(
|
||||
projectId,
|
||||
expectedRevision,
|
||||
{
|
||||
schemaVersion: 1,
|
||||
type: "circuit.renumber-section",
|
||||
payload: { sectionId, assignments },
|
||||
},
|
||||
description
|
||||
);
|
||||
}
|
||||
|
||||
export function listFloors(projectId: string) {
|
||||
|
||||
Reference in New Issue
Block a user