added place to telecommunication, added contract documents, added invoice to other contracts

This commit is contained in:
2026-03-25 16:55:48 +01:00
parent eaa94e766a
commit 3dd4f7b656
30 changed files with 3424 additions and 90 deletions
+27 -2
View File
@@ -656,11 +656,29 @@ model Contract {
tasks ContractTask[]
assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client
historyEntries ContractHistoryEntry[]
documents ContractDocument[]
invoices Invoice[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// ==================== CONTRACT DOCUMENTS ====================
model ContractDocument {
id Int @id @default(autoincrement())
contractId Int
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
documentType String // Auftragsformular, Lieferbestätigung, etc.
documentPath String // Dateipfad
originalName String // Originaler Dateiname
notes String? @db.Text
uploadedBy String? // Wer hat hochgeladen
createdAt DateTime @default(now())
@@index([contractId])
}
// ==================== CONTRACT HISTORY ====================
model ContractHistoryEntry {
@@ -753,8 +771,10 @@ model ContractMeter {
model Invoice {
id Int @id @default(autoincrement())
energyContractDetailsId Int
energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)
energyContractDetailsId Int?
energyContractDetails EnergyContractDetails? @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)
contractId Int?
contract Contract? @relation(fields: [contractId], references: [id], onDelete: Cascade)
invoiceDate DateTime
invoiceType InvoiceType
documentPath String? // Pflicht, außer bei NOT_AVAILABLE
@@ -763,6 +783,7 @@ model Invoice {
updatedAt DateTime @updatedAt
@@index([energyContractDetailsId])
@@index([contractId])
}
// ==================== INTERNET CONTRACT DETAILS ====================
@@ -779,6 +800,10 @@ model InternetContractDetails {
// Internet-Zugangsdaten
internetUsername String?
internetPasswordEncrypted String? // Verschlüsselt gespeichert
// Objekt & Lage
propertyType String? // Objekttyp (Mehrparteienhaus, Freistehendes Haus, etc.)
propertyLocation String? // Lage (Erdgeschoss, OG1, etc.)
connectionLocation String? // Lage des Anschlusses (Flur, HWR, etc.)
// Glasfaser-spezifisch
homeId String?
// Vodafone DSL/Kabel spezifisch