Add configurable distribution supply types

This commit is contained in:
Julian Appel 2026-07-29 09:31:20 +02:00
parent 194bc9c0b1
commit b1a11397b3
43 changed files with 5697 additions and 126 deletions

View file

@ -0,0 +1,26 @@
export const distributionBoardSupplyTypes = [
"AV",
"SV",
"EV",
"USV",
"MSR",
"SiBe",
] as const;
export type DistributionBoardSupplyType =
(typeof distributionBoardSupplyTypes)[number];
export const defaultDistributionBoardSupplyTypes: DistributionBoardSupplyType[] =
[...distributionBoardSupplyTypes];
export const distributionBoardSupplyTypeLabels: Record<
DistributionBoardSupplyType,
string
> = {
AV: "AV Allgemeine Stromversorgung",
SV: "SV Sicherheitsstromversorgung",
EV: "EV Ersatzstromversorgung",
USV: "USV Unterbrechungsfreie Stromversorgung",
MSR: "MSR Mess-, Steuerungs- und Regelungstechnik",
SiBe: "SiBe Sicherheitsbeleuchtung",
};

View file

@ -1,4 +1,5 @@
import { z } from "zod";
import { distributionBoardSupplyTypes } from "../constants/distribution-board.js";
import { expectedProjectRevisionSchema } from "./project-command.schemas.js";
export const createProjectSchema = z.object({
@ -21,6 +22,12 @@ export const updateProjectSettingsSchema = z
description: z.string().trim().max(2000).nullable(),
singlePhaseVoltageV: z.number().positive(),
threePhaseVoltageV: z.number().positive(),
enabledDistributionBoardSupplyTypes: z
.array(z.enum(distributionBoardSupplyTypes))
.min(1)
.refine((values) => new Set(values).size === values.length, {
message: "Netzarten dürfen nicht mehrfach ausgewählt werden.",
}),
})
.strict();
@ -28,6 +35,16 @@ export const createDistributionBoardSchema = z
.object({
expectedRevision: expectedProjectRevisionSchema,
name: z.string().trim().min(1),
floorId: z.string().trim().min(1).nullable(),
supplyType: z.enum(distributionBoardSupplyTypes),
})
.strict();
export const updateDistributionBoardSchema = z
.object({
expectedRevision: expectedProjectRevisionSchema,
floorId: z.string().trim().min(1).nullable(),
supplyType: z.enum(distributionBoardSupplyTypes),
})
.strict();