Persist distribution board setup

This commit is contained in:
Julian Appel 2026-07-25 23:41:27 +02:00
parent 1a77eedaa8
commit 1cf26a932e
21 changed files with 1027 additions and 22 deletions

View file

@ -1,15 +1,11 @@
import crypto from "node:crypto";
import { and, asc, eq } from "drizzle-orm";
import { defaultCircuitSectionDefinitions } from "../../domain/models/distribution-board-structure-project-command.model.js";
import { db } from "../client.js";
import { circuitSections } from "../schema/circuit-sections.js";
export function createDefaultCircuitSectionValues(circuitListId: string) {
return [
{ key: "lighting", displayName: "Lighting", prefix: "-1F", sortOrder: 10 },
{ key: "single_phase", displayName: "Single-phase circuits", prefix: "-2F", sortOrder: 20 },
{ key: "three_phase", displayName: "Three-phase circuits", prefix: "-3F", sortOrder: 30 },
{ key: "unassigned", displayName: "Unassigned", prefix: "-UF", sortOrder: 90 },
].map((entry) => ({
return defaultCircuitSectionDefinitions.map((entry) => ({
id: crypto.randomUUID(),
circuitListId,
...entry,