Files
Materialschein/server/prisma/schema.prisma
T
Fidelis HuberandClaude Sonnet 5.5 b6227eb4cf
Build and Deploy / version (push) Successful in 1s
Build and Deploy / build (push) Successful in 14s
Build and Deploy / deploy (push) Successful in 1s
Bestellschein-Tab, Favoriten je Benutzer (Scheine + Kabel), Kabelsuche, Loxone Link Kabel Cat.7
- Neuer Tab Bestellschein: gleiches Datenmodell/Funktionen wie Materialschein (Projekt.typ)
- Favoriten serverseitig pro Benutzer (Tabelle favoriten, /api/favoriten)
- Kabelauswahl mit Suchfeld + Favoriten (KabelSelect), Suche/Favoriten in der Referenztabelle
- Scheinsuche: mehrere Suchbegriffe, auch Notiz/Datum; Filter Favoriten

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-09 20:04:52 +02:00

81 lines
2.0 KiB
Plaintext

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum ProjektStatus {
Aktiv
Abgeschlossen
}
// Materialschein und Bestellschein teilen sich dieselbe Struktur (Kopfdaten + Positionen).
enum ScheinTyp {
Material
Bestell
}
model Projekt {
id String @id @default(cuid())
titel String
auftraggeber String?
auftragsNr String?
datum DateTime? @db.Date
monteur String?
notiz String?
status ProjektStatus @default(Aktiv)
typ ScheinTyp @default(Material)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
material Material[]
@@index([typ])
@@map("projekte")
}
model Material {
id String @id @default(cuid())
projektId String
projekt Projekt @relation(fields: [projektId], references: [id], onDelete: Cascade)
bezeichnung String
artNr String?
menge Decimal @db.Decimal(10, 2)
einheit String
notiz String?
erstelltVon String?
createdAt DateTime @default(now())
@@index([projektId])
@@map("material")
}
// Lokales Konto als Fallback, falls Microsoft-Login nicht verfügbar ist.
// passwordHash ist ein bcrypt-Hash, das Klartext-Passwort wird nie gespeichert.
model User {
id String @id @default(cuid())
username String @unique
passwordHash String
name String?
createdAt DateTime @default(now())
@@map("users")
}
// Favoriten je Benutzer (Microsoft-Konto per oid, lokales Konto per Benutzername).
// art = SCHEIN (refId = Projekt-ID) oder KABEL (refId = Kabelname aus der Kabelliste).
model Favorit {
id String @id @default(cuid())
userKey String
art String
refId String
createdAt DateTime @default(now())
@@unique([userKey, art, refId])
@@index([userKey])
@@map("favoriten")
}