Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -65,15 +65,23 @@ model Pipeline {
isDefault Boolean @default(false)
isDemoData Boolean @default(false)
archivedAt DateTime?
/// WF-P8 M04: pipeline a project hands over to once it reaches the final
/// stage here. Null = this pipeline is terminal and M04 never opens.
nachfolgePipelineId String?
stages PipelineStage[]
accessRules PipelineAccess[]
fieldConfigs PipelineFieldConfig[]
fieldGroups PipelineFieldGroup[]
projekte Projekt[]
nachfolgePipeline Pipeline? @relation("PipelineNachfolge", fields: [nachfolgePipelineId], references: [id], onDelete: SetNull)
vorgaengerPipelines Pipeline[] @relation("PipelineNachfolge")
@@unique([tenantId, name])
@@index([tenantId, typHint, archivedAt])
@@index([tenantId, position])
@@index([tenantId, nachfolgePipelineId])
}
model PipelineStage {
@@ -93,8 +101,11 @@ model PipelineStage {
pipeline Pipeline @relation(fields: [pipelineId], references: [id], onDelete: Cascade)
fieldConfigs PipelineFieldConfig[]
projekte Projekt[]
portalVisibilities PortalStageVisibility[]
portalEmailTemplates PortalEmailTemplate[]
@@unique([pipelineId, name])
@@unique([id, tenantId])
@@index([tenantId, pipelineId, archivedAt])
@@index([tenantId, stageKind])
}
@@ -115,6 +126,27 @@ model PipelineAccess {
@@index([tenantId, principalType, principalId])
}
/// WF-P8 S05: a named section of the project detail template ("Grunddaten",
/// "Planung & Verantwortliche", "KWP-Integration", …). System groups ship with
/// the pipeline and may be reordered but not deleted (`istSystem`).
model PipelineFieldGroup {
id String @id @default(cuid())
tenantId String
pipelineId String
name String
reihenfolge Int @default(0)
istSystem Boolean @default(false)
isDemoData Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
pipeline Pipeline @relation(fields: [pipelineId], references: [id], onDelete: Cascade)
fieldConfigs PipelineFieldConfig[]
@@unique([pipelineId, name])
@@index([tenantId, pipelineId, reihenfolge])
}
model PipelineFieldConfig {
id String @id @default(cuid())
tenantId String
@@ -126,14 +158,28 @@ model PipelineFieldConfig {
reihenfolge Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
/// WF-P8 S05 template layout: owning section. Null = field sits in the
/// "Bestandsfelder" pool outside the template.
groupId String?
/// WF-P8 S05 "Pflicht ab Board-Spalte": the field only becomes mandatory once
/// the project reaches this stage. Null = `pflicht` applies unconditionally.
pflichtAbStageId String?
/// WF-P8 S05 optional helper text rendered under the field.
hinweis String?
/// WF-P8 S05: system fields may be reordered/locked but never deleted.
istSystem Boolean @default(false)
/// WF-P8 S05 legend "gesperrt / nur lesbar".
gesperrt Boolean @default(false)
pipeline Pipeline @relation(fields: [pipelineId], references: [id], onDelete: Cascade)
stage PipelineStage? @relation(fields: [stageId], references: [id], onDelete: Cascade)
group PipelineFieldGroup? @relation(fields: [groupId], references: [id], onDelete: SetNull)
visibilities PipelineFieldVisibility[]
@@unique([pipelineId, stageId, fieldKey])
@@index([tenantId, pipelineId])
@@index([tenantId, fieldKey])
@@index([tenantId, groupId, reihenfolge])
}
model PipelineFieldVisibility {
@@ -158,6 +204,14 @@ model LostReason {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
/// WF-P8 S06: one-line explanation shown next to the reason in the admin table.
beschreibung String?
/// WF-P8 S06: free-text grouping ("Preis", "Budget", "Wettbewerb", ...).
kategorie String?
/// WF-P8 S06: true for the SHK reasons the tenant seed ships, false for
/// reasons the tenant created itself. Distinct from isDemoData, which marks
/// throwaway demo rows.
istVorlage Boolean @default(false)
position Int @default(0)
isDemoData Boolean @default(false)
archivedAt DateTime?
@@ -179,6 +233,13 @@ model Projekt {
beschreibung String?
projekttyp String?
quelle String?
/// WF-P8 S02 "Grunddaten": campaign/promotion the project came in through.
promotion String?
/// WF-P8 S02 "Projektkontaktdaten": contact channels of the project itself,
/// distinct from the linked Kontakt records (site office, site phone, ...).
email String?
telefon String?
fax String?
prioritaet ProjektPrioritaet @default(normal)
pipelineId String
stageId String
@@ -196,6 +257,14 @@ model Projekt {
wonAt DateTime?
lostAt DateTime?
undoStageChangeUntil DateTime?
// WF-P8 M03 "Wiederholen": the stage an undo moved the project away from, so
// the board can offer redo without querying the stage history per card. Set
// when an undo runs, cleared by the next forward move.
redoStageId String?
// The reason that came with the undone move. A lost stage cannot be entered
// without one, so a redo would otherwise be rejected for exactly the moves
// the undo window exists for.
redoLostReasonId String?
isDemoData Boolean @default(false)
archivedAt DateTime?
@@ -204,8 +273,14 @@ model Projekt {
lostReason LostReason? @relation(fields: [lostReasonId], references: [id], onDelete: SetNull)
kontakte ProjektKontakt[]
stageChanges ProjektStageChange[]
mitglieder ProjektMitglied[]
adressDetails ProjektAdressDetail[]
checklists ProjektChecklist[]
portalAccesses PortalProjectAccess[]
portalDocuments PortalProjectDocument[]
@@unique([tenantId, projektNummer])
@@unique([id, tenantId])
@@index([tenantId, pipelineId, stageId, archivedAt])
@@index([tenantId, zustaendigePersonId])
@@index([tenantId, projektleiterId])
@@ -220,6 +295,8 @@ model ProjektStageChange {
fromStageId String
toStageId String
lostReasonId String?
/// WF-P8 M01: free-text note the user leaves when marking a project lost.
notiz String?
changedByUserId String?
undoUntil DateTime?
undoneAt DateTime?
@@ -269,3 +346,48 @@ model ProjektKontakt {
@@index([tenantId, projektId])
@@index([tenantId, kontaktId])
}
/// WF-P8 S02 "Adressdaten": which of the three project address slots a detail row
/// belongs to. Mirrors the three address FKs on Projekt.
enum ProjektAdressSlot {
projekt
rechnung
bauherr
}
/// The per-slot extras the S02 address group asks for on top of the shared
/// `Adresse`. Deliberately NOT columns on `Adresse`: that is a shared CRM entity
/// which contacts reuse, so a project's "Zahlungsziel" or "Zufahrt" would leak
/// into every contact address. One row per project and slot.
model ProjektAdressDetail {
id String @id @default(cuid())
tenantId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
projektId String
slot ProjektAdressSlot
/// Slot "projekt": where on the site the work happens and how to get there.
bauabschnitt String?
zufahrt String?
koordinaten String?
/// Slot "rechnung": who receives the invoice, on what terms, and where the
/// invoice itself is sent. Separate from `Projekt.email`, which is the
/// operational contact address of the project.
empfaenger String?
zahlungsziel String?
rechnungsEmail String?
/// Slot "bauherr": whether the building owner wants postal mail, and who to
/// reach on site. The owner is often not the CRM contact carrying the project.
postErwuenscht Boolean @default(false)
telefon String?
ansprechpartnerVorOrt String?
/// Free text, one per slot. The content is slot-specific — delivery
/// constraints at the site, payment remarks on the invoice address — so it
/// cannot live on the shared `Adresse` any more than the fields above.
notizen String?
projekt Projekt @relation(fields: [projektId], references: [id], onDelete: Cascade)
@@unique([projektId, slot])
@@index([tenantId, projektId])
}