Datenschutz vollmacht fixed, two time counter added
This commit is contained in:
+43
-17
@@ -411,18 +411,25 @@ enum MeterType {
|
||||
GAS
|
||||
}
|
||||
|
||||
enum MeterTariffModel {
|
||||
SINGLE // Eintarifzähler (Standard)
|
||||
DUAL // Zweitarifzähler (HT/NT)
|
||||
}
|
||||
|
||||
model Meter {
|
||||
id Int @id @default(autoincrement())
|
||||
customerId Int
|
||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
||||
meterNumber String
|
||||
type MeterType
|
||||
location String?
|
||||
isActive Boolean @default(true)
|
||||
readings MeterReading[]
|
||||
energyDetails EnergyContractDetails[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id Int @id @default(autoincrement())
|
||||
customerId Int
|
||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
||||
meterNumber String
|
||||
type MeterType
|
||||
tariffModel MeterTariffModel @default(SINGLE) // Eintarif oder Zweitarif (HT/NT)
|
||||
location String?
|
||||
isActive Boolean @default(true)
|
||||
readings MeterReading[]
|
||||
energyDetails EnergyContractDetails[]
|
||||
contractMeters ContractMeter[] @relation("ContractMeters")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model MeterReading {
|
||||
@@ -430,7 +437,8 @@ model MeterReading {
|
||||
meterId Int
|
||||
meter Meter @relation(fields: [meterId], references: [id], onDelete: Cascade)
|
||||
readingDate DateTime
|
||||
value Float
|
||||
value Float // Bei Eintarif: Gesamtwert. Bei Zweitarif: HT-Wert
|
||||
valueNt Float? // Nur bei Zweitarif: NT-Wert (Niedertarif)
|
||||
unit String @default("kWh")
|
||||
notes String?
|
||||
// Meldung & Übertragung
|
||||
@@ -709,20 +717,38 @@ enum InvoiceType {
|
||||
}
|
||||
|
||||
model EnergyContractDetails {
|
||||
id Int @id @default(autoincrement())
|
||||
contractId Int @unique
|
||||
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||||
id Int @id @default(autoincrement())
|
||||
contractId Int @unique
|
||||
contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||||
meterId Int?
|
||||
meter Meter? @relation(fields: [meterId], references: [id])
|
||||
meter Meter? @relation(fields: [meterId], references: [id])
|
||||
maloId String? // Marktlokations-ID
|
||||
annualConsumption Float? // kWh für Strom, m³ für Gas
|
||||
annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)
|
||||
basePrice Float? // €/Monat
|
||||
unitPrice Float? // €/kWh (Arbeitspreis)
|
||||
unitPrice Float? // €/kWh (Arbeitspreis) - bei HT/NT: HT-Preis
|
||||
unitPriceNt Float? // €/kWh NT-Preis (nur bei Zweitarifzähler)
|
||||
bonus Float?
|
||||
previousProviderName String?
|
||||
previousCustomerNumber String?
|
||||
invoices Invoice[] // Rechnungen
|
||||
contractMeters ContractMeter[] // Zähler-Zuordnungen (inkl. Folgezähler)
|
||||
}
|
||||
|
||||
model ContractMeter {
|
||||
id Int @id @default(autoincrement())
|
||||
energyContractDetailsId Int
|
||||
energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)
|
||||
meterId Int
|
||||
meter Meter @relation("ContractMeters", fields: [meterId], references: [id])
|
||||
position Int @default(0) // 0 = Original, 1 = erster Folgezähler, etc.
|
||||
installedAt DateTime? // Ab wann wird dieser Zähler am Vertrag genutzt?
|
||||
removedAt DateTime? // Wann wurde der Zähler gewechselt? (null = aktuell)
|
||||
finalReading Float? // Letzter Stand vor dem Wechsel
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([energyContractDetailsId, meterId])
|
||||
@@index([energyContractDetailsId])
|
||||
}
|
||||
|
||||
model Invoice {
|
||||
|
||||
Reference in New Issue
Block a user