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
@@ -0,0 +1,30 @@
import type { Request, Response } from "express";
import { FloorRepository } from "../../db/repositories/floor.repository.js";
import { createFloorSchema } from "../../shared/validation/consumer.schemas.js";
const floorRepository = new FloorRepository();
export async function listFloorsByProject(req: Request, res: Response) {
const { projectId } = req.params;
if (typeof projectId !== "string") {
return res.status(400).json({ error: "Invalid projectId" });
}
const result = await floorRepository.listByProject(projectId);
return res.json(result);
}
export async function createFloor(req: Request, res: Response) {
const { projectId } = req.params;
if (typeof projectId !== "string") {
return res.status(400).json({ error: "Invalid projectId" });
}
const parsed = createFloorSchema.safeParse(req.body);
if (!parsed.success) {
return res.status(400).json({ error: parsed.error.flatten() });
}
const floor = await floorRepository.create(projectId, parsed.data.name);
return res.status(201).json(floor);
}