Create clean release database baseline

This commit is contained in:
Julian Appel 2026-07-31 14:07:26 +02:00
parent 5bee3cb103
commit 734a2bcfc4
129 changed files with 2121 additions and 30607 deletions

View file

@ -130,8 +130,6 @@ export const defaultVisibleColumnKeys = allColumns
const projectColumnLayoutStoragePrefix =
"circuitTreeEditor.columnLayout.v3";
const legacyProjectColumnLayoutStoragePrefix =
"circuitTreeEditor.columnLayout.v2";
export interface CircuitColumnLayout {
order: CellKey[];
@ -164,12 +162,6 @@ export function getProjectColumnLayoutStorageKey(
return `${projectColumnLayoutStoragePrefix}.${projectId}`;
}
export function getLegacyProjectColumnLayoutStorageKey(
projectId: string
): string {
return `${legacyProjectColumnLayoutStoragePrefix}.${projectId}`;
}
export function normalizeColumnOrder(keys: CellKey[]): CellKey[] {
const unique = [...new Set(keys)];
const allKeys = allColumns.map((column) => column.key);
@ -233,28 +225,6 @@ export function parseStoredColumnLayout(
}
}
export function migrateLegacyColumnLayout(
layout: CircuitColumnLayout
): CircuitColumnLayout {
const newlyVisibleKey: CellKey = "protectionSummary";
const order = layout.order.filter(
(key) => key !== newlyVisibleKey
) as CellKey[];
const totalPowerIndex = order.indexOf("rowTotalPower");
order.splice(
totalPowerIndex >= 0 ? totalPowerIndex + 1 : order.length,
0,
newlyVisibleKey
);
return {
order,
visible: layout.visible.includes(newlyVisibleKey)
? layout.visible
: [...layout.visible, newlyVisibleKey],
};
}
const deviceOnlyColumns = new Set<CellKey>([
"quantity",
"powerPerUnit",
@ -422,11 +392,7 @@ export function buildCircuitEditPatch(
if (key === "protectionSummary" || key === "cableSummary") {
return { remark: draft.trim() || null };
}
if (
key === "protectionRatedCurrent" ||
key === "cableLength" ||
key === "voltage"
) {
if (key === "cableLength" || key === "voltage") {
return { [key]: parseNumeric(key, draft) ?? null };
}
if (key === "isReserve") {
@ -530,23 +496,14 @@ export function getCircuitValue(circuit: CircuitTreeCircuitDto, key: CellKey): G
case "protectionType":
return protection
? protectionDeviceTypeLabels[protection.type]
: circuit.protectionType;
: undefined;
case "protectionRatedCurrent":
return protection?.ratedCurrentA ?? circuit.protectionRatedCurrent;
return protection?.ratedCurrentA;
case "protectionCharacteristic":
return protectionCharacteristic || circuit.protectionCharacteristic;
return protectionCharacteristic || undefined;
case "protectionSummary": {
if (!protection) {
const legacyCurrent =
circuit.protectionRatedCurrent !== undefined &&
circuit.protectionRatedCurrent !== null
? `${circuit.protectionRatedCurrent}A`
: "";
return [
circuit.protectionType,
legacyCurrent,
circuit.protectionCharacteristic,
].filter(Boolean).join(" ").trim() || undefined;
return undefined;
}
const currentValue =
protection.ratedCurrentA;

View file

@ -117,11 +117,6 @@ export function buildCircuitGroupSubtreeSnapshot(
equipmentIdentifier: circuit.equipmentIdentifier,
displayName: circuit.displayName ?? null,
sortOrder: circuit.sortOrder,
protectionType: circuit.protectionType ?? null,
protectionRatedCurrent:
circuit.protectionRatedCurrent ?? null,
protectionCharacteristic:
circuit.protectionCharacteristic ?? null,
cableType: circuit.cableType ?? null,
cableCrossSection: circuit.cableCrossSection ?? null,
cableLength: circuit.cableLength ?? null,
@ -143,7 +138,6 @@ export function buildCircuitGroupSubtreeSnapshot(
circuitId: circuit.id,
linkedProjectDeviceId:
row.linkedProjectDeviceId ?? null,
legacyConsumerId: row.legacyConsumerId ?? null,
sortOrder: row.sortOrder,
name: row.name,
displayName: row.displayName,

View file

@ -22,7 +22,6 @@ export function buildCircuitDeviceRowInsertSnapshot(input: {
id,
circuitId,
linkedProjectDeviceId: values.linkedProjectDeviceId ?? null,
legacyConsumerId: null,
sortOrder: values.sortOrder ?? defaultSortOrder,
name: values.name,
displayName: values.displayName,
@ -61,9 +60,6 @@ export function buildCircuitInsertSnapshot(input: {
equipmentIdentifier: values.equipmentIdentifier,
displayName: values.displayName ?? null,
sortOrder: values.sortOrder,
protectionType: values.protectionType ?? null,
protectionRatedCurrent: values.protectionRatedCurrent ?? null,
protectionCharacteristic: values.protectionCharacteristic ?? null,
cableType: values.cableType ?? null,
cableCrossSection: values.cableCrossSection ?? null,
cableLength: values.cableLength ?? null,