Rewrite frontend, added rooms, voltage selection per project, startet with todos

This commit is contained in:
2026-05-01 17:07:56 +02:00
parent 81d47ce16f
commit 65819900b1
49 changed files with 3695 additions and 394 deletions
+18
View File
@@ -0,0 +1,18 @@
import { sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
import { distributionBoards } from "./distribution-boards.js";
import { projects } from "./projects.js";
export const circuitLists = sqliteTable(
"circuit_lists",
{
id: text("id").primaryKey(),
projectId: text("project_id")
.notNull()
.references(() => projects.id, { onDelete: "cascade" }),
distributionBoardId: text("distribution_board_id")
.notNull()
.references(() => distributionBoards.id, { onDelete: "cascade" }),
name: text("name").notNull(),
},
(table) => [unique("circuit_lists_distribution_board_id_unique").on(table.distributionBoardId)]
);
+20 -1
View File
@@ -1,6 +1,8 @@
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { circuitLists } from "./circuit-lists.js";
import { distributionBoards } from "./distribution-boards.js";
import { projects } from "./projects.js";
import { rooms } from "./rooms.js";
export const consumers = sqliteTable("consumers", {
id: text("id").primaryKey(),
@@ -10,8 +12,26 @@ export const consumers = sqliteTable("consumers", {
distributionBoardId: text("distribution_board_id").references(() => distributionBoards.id, {
onDelete: "set null",
}),
circuitListId: text("circuit_list_id").references(() => circuitLists.id, {
onDelete: "set null",
}),
roomId: text("room_id").references(() => rooms.id, {
onDelete: "set null",
}),
circuitNumber: text("circuit_number"),
description: text("description"),
name: text("name").notNull(),
category: text("category"),
deviceType: text("device_type"),
phaseType: text("phase_type"),
tradeOrCostGroup: text("trade_or_cost_group"),
group: text("group_name"),
protectionType: text("protection_type"),
protectionRatedCurrent: real("protection_rated_current"),
protectionCharacteristic: text("protection_characteristic"),
cableType: text("cable_type"),
cableCrossSection: text("cable_cross_section"),
comment: text("comment"),
quantity: integer("quantity").notNull(),
installedPowerPerUnitKw: real("installed_power_per_unit_kw").notNull(),
demandFactor: real("demand_factor").notNull(),
@@ -20,4 +40,3 @@ export const consumers = sqliteTable("consumers", {
powerFactor: real("power_factor"),
note: text("note"),
});
+11
View File
@@ -0,0 +1,11 @@
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { projects } from "./projects.js";
export const floors = sqliteTable("floors", {
id: text("id").primaryKey(),
projectId: text("project_id")
.notNull()
.references(() => projects.id, { onDelete: "cascade" }),
name: text("name").notNull(),
sortOrder: integer("sort_order").notNull().default(0),
});
+14
View File
@@ -0,0 +1,14 @@
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const globalDevices = sqliteTable("global_devices", {
id: text("id").primaryKey(),
name: text("name").notNull(),
category: text("category"),
quantity: integer("quantity").notNull(),
installedPowerPerUnitKw: real("installed_power_per_unit_kw").notNull(),
demandFactor: real("demand_factor").notNull(),
voltageV: real("voltage_v"),
phaseCount: integer("phase_count"),
powerFactor: real("power_factor"),
note: text("note"),
});
+18
View File
@@ -0,0 +1,18 @@
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { projects } from "./projects.js";
export const projectDevices = sqliteTable("project_devices", {
id: text("id").primaryKey(),
projectId: text("project_id")
.notNull()
.references(() => projects.id, { onDelete: "cascade" }),
name: text("name").notNull(),
category: text("category"),
quantity: integer("quantity").notNull(),
installedPowerPerUnitKw: real("installed_power_per_unit_kw").notNull(),
demandFactor: real("demand_factor").notNull(),
voltageV: real("voltage_v"),
phaseCount: integer("phase_count"),
powerFactor: real("power_factor"),
note: text("note"),
});
+3 -2
View File
@@ -1,7 +1,8 @@
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const projects = sqliteTable("projects", {
id: text("id").primaryKey(),
name: text("name").notNull(),
singlePhaseVoltageV: integer("single_phase_voltage_v").notNull().default(230),
threePhaseVoltageV: integer("three_phase_voltage_v").notNull().default(400),
});
+13
View File
@@ -0,0 +1,13 @@
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
import { floors } from "./floors.js";
import { projects } from "./projects.js";
export const rooms = sqliteTable("rooms", {
id: text("id").primaryKey(),
projectId: text("project_id")
.notNull()
.references(() => projects.id, { onDelete: "cascade" }),
floorId: text("floor_id").references(() => floors.id, { onDelete: "set null" }),
roomNumber: text("room_number").notNull(),
roomName: text("room_name").notNull(),
});