Persist circuit reorders

This commit is contained in:
2026-07-25 21:22:10 +02:00
parent 08a2775a88
commit abcb468807
26 changed files with 914 additions and 372 deletions
-33
View File
@@ -109,39 +109,6 @@ describe("circuit write service rules", () => {
assert.equal(safeCalled, 1);
});
it("reorders circuits inside one section without renumbering identifiers", async () => {
let safeReorder: { sectionId: string; circuitIds: string[] } | undefined;
const service = new CircuitWriteService({
circuitSectionRepository: {
async findById() {
return { id: "s1", circuitListId: "l1" } as never;
},
} as never,
circuitRepository: {
async listBySection() {
return [
{ id: "c1", sectionId: "s1", equipmentIdentifier: "-2F7", sortOrder: 10, isReserve: 0 },
{ id: "c2", sectionId: "s1", equipmentIdentifier: "-2F9", sortOrder: 20, isReserve: 0 },
{ id: "c3", sectionId: "s1", equipmentIdentifier: "-2F5", sortOrder: 30, isReserve: 1 },
] as never[];
},
} as never,
circuitSectionTransactionStore: {
updateSortOrders(sectionId: string, circuitIds: string[]) {
safeReorder = { sectionId, circuitIds };
},
} as never,
});
await service.reorderCircuitsInSection("s1", {
orderedCircuitIds: ["c3", "c1", "c2"],
});
assert.deepEqual(safeReorder, {
sectionId: "s1",
circuitIds: ["c3", "c1", "c2"],
});
});
it("validates the complete section set before safe identifier updates", async () => {
let safeCalled = false;
const service = new CircuitWriteService({