Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,271 @@
|
||||
// R-P8a (P8 Projekt & Pipelines core) — typed project/pipeline entities.
|
||||
//
|
||||
// AD-20: there is ONE `Projekt` core. "Deal" and "Auftrag" are pipeline
|
||||
// views (`Pipeline.typHint`), not separate entities and not a won-handoff copy.
|
||||
//
|
||||
// AD-21: this module owns its schema file. Cross-module references to Tenant,
|
||||
// User, Kontakt, InboxLead and Adresse are intentionally bare String scalars so
|
||||
// this slice does not modify core/accounts/crm/leads schemas.
|
||||
|
||||
enum PipelineTypHint {
|
||||
sales
|
||||
auftrag
|
||||
custom
|
||||
}
|
||||
|
||||
enum PipelineStageKind {
|
||||
offen
|
||||
gewonnen
|
||||
verloren
|
||||
}
|
||||
|
||||
enum PipelinePrincipalType {
|
||||
role
|
||||
group
|
||||
user
|
||||
}
|
||||
|
||||
enum ProjektPrioritaet {
|
||||
niedrig
|
||||
normal
|
||||
hoch
|
||||
dringend
|
||||
}
|
||||
|
||||
enum ProjektKontaktRolle {
|
||||
auftraggeber
|
||||
bauherr
|
||||
rechnungsempfaenger
|
||||
ansprechpartner
|
||||
}
|
||||
|
||||
model HiveNumberSeq {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
entityType String
|
||||
prefix String
|
||||
nextNumber Int @default(1)
|
||||
padding Int @default(5)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([tenantId, entityType])
|
||||
@@index([tenantId])
|
||||
}
|
||||
|
||||
model Pipeline {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdByUserId String?
|
||||
name String
|
||||
typHint PipelineTypHint
|
||||
position Int @default(0)
|
||||
isDefault Boolean @default(false)
|
||||
isDemoData Boolean @default(false)
|
||||
archivedAt DateTime?
|
||||
|
||||
stages PipelineStage[]
|
||||
accessRules PipelineAccess[]
|
||||
fieldConfigs PipelineFieldConfig[]
|
||||
projekte Projekt[]
|
||||
|
||||
@@unique([tenantId, name])
|
||||
@@index([tenantId, typHint, archivedAt])
|
||||
@@index([tenantId, position])
|
||||
}
|
||||
|
||||
model PipelineStage {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
pipelineId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String
|
||||
stageKind PipelineStageKind
|
||||
winProbability Int @default(0)
|
||||
color String @default("#6b7280")
|
||||
position Int @default(0)
|
||||
isDemoData Boolean @default(false)
|
||||
archivedAt DateTime?
|
||||
|
||||
pipeline Pipeline @relation(fields: [pipelineId], references: [id], onDelete: Cascade)
|
||||
fieldConfigs PipelineFieldConfig[]
|
||||
projekte Projekt[]
|
||||
|
||||
@@unique([pipelineId, name])
|
||||
@@index([tenantId, pipelineId, archivedAt])
|
||||
@@index([tenantId, stageKind])
|
||||
}
|
||||
|
||||
model PipelineAccess {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
pipelineId String
|
||||
principalType PipelinePrincipalType
|
||||
principalId String
|
||||
kannSehen Boolean @default(true)
|
||||
kannBearbeiten Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
pipeline Pipeline @relation(fields: [pipelineId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([pipelineId, principalType, principalId])
|
||||
@@index([tenantId, principalType, principalId])
|
||||
}
|
||||
|
||||
model PipelineFieldConfig {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
pipelineId String
|
||||
stageId String?
|
||||
fieldKey String
|
||||
sichtbar Boolean @default(true)
|
||||
pflicht Boolean @default(false)
|
||||
reihenfolge Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
pipeline Pipeline @relation(fields: [pipelineId], references: [id], onDelete: Cascade)
|
||||
stage PipelineStage? @relation(fields: [stageId], references: [id], onDelete: Cascade)
|
||||
visibilities PipelineFieldVisibility[]
|
||||
|
||||
@@unique([pipelineId, stageId, fieldKey])
|
||||
@@index([tenantId, pipelineId])
|
||||
@@index([tenantId, fieldKey])
|
||||
}
|
||||
|
||||
model PipelineFieldVisibility {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
fieldConfigId String
|
||||
principalType PipelinePrincipalType
|
||||
principalId String
|
||||
kannSehen Boolean @default(true)
|
||||
kannBearbeiten Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
fieldConfig PipelineFieldConfig @relation(fields: [fieldConfigId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([fieldConfigId, principalType, principalId])
|
||||
@@index([tenantId, principalType, principalId])
|
||||
}
|
||||
|
||||
model LostReason {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String
|
||||
position Int @default(0)
|
||||
isDemoData Boolean @default(false)
|
||||
archivedAt DateTime?
|
||||
|
||||
projekte Projekt[]
|
||||
|
||||
@@unique([tenantId, name])
|
||||
@@index([tenantId, archivedAt])
|
||||
}
|
||||
|
||||
model Projekt {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdByUserId String?
|
||||
projektNummer String
|
||||
projektname String
|
||||
beschreibung String?
|
||||
projekttyp String?
|
||||
quelle String?
|
||||
prioritaet ProjektPrioritaet @default(normal)
|
||||
pipelineId String
|
||||
stageId String
|
||||
potenziellerAuftragswert Decimal?
|
||||
auftragsvolumen Decimal?
|
||||
startDatum DateTime?
|
||||
deadline DateTime?
|
||||
zustaendigePersonId String?
|
||||
projektleiterId String?
|
||||
projektAdresseId String?
|
||||
rechnungsAdresseId String?
|
||||
bauherrAdresseId String?
|
||||
konvertiertAusLeadId String?
|
||||
lostReasonId String?
|
||||
wonAt DateTime?
|
||||
lostAt DateTime?
|
||||
undoStageChangeUntil DateTime?
|
||||
isDemoData Boolean @default(false)
|
||||
archivedAt DateTime?
|
||||
|
||||
pipeline Pipeline @relation(fields: [pipelineId], references: [id])
|
||||
stage PipelineStage @relation(fields: [stageId], references: [id])
|
||||
lostReason LostReason? @relation(fields: [lostReasonId], references: [id], onDelete: SetNull)
|
||||
kontakte ProjektKontakt[]
|
||||
stageChanges ProjektStageChange[]
|
||||
|
||||
@@unique([tenantId, projektNummer])
|
||||
@@index([tenantId, pipelineId, stageId, archivedAt])
|
||||
@@index([tenantId, zustaendigePersonId])
|
||||
@@index([tenantId, projektleiterId])
|
||||
@@index([tenantId, konvertiertAusLeadId])
|
||||
@@index([tenantId, lostReasonId])
|
||||
}
|
||||
|
||||
model ProjektStageChange {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
projektId String
|
||||
fromStageId String
|
||||
toStageId String
|
||||
lostReasonId String?
|
||||
changedByUserId String?
|
||||
undoUntil DateTime?
|
||||
undoneAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
projekt Projekt @relation(fields: [projektId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([tenantId, projektId, createdAt])
|
||||
@@index([tenantId, toStageId, createdAt])
|
||||
@@index([tenantId, undoUntil])
|
||||
}
|
||||
|
||||
model PipelineAggregateSnapshot {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
pipelineId String
|
||||
stageId String?
|
||||
scopeKey String
|
||||
projectCount Int @default(0)
|
||||
potentialValue Decimal @default(0)
|
||||
orderVolume Decimal @default(0)
|
||||
weightedForecast Decimal @default(0)
|
||||
realizedRevenue Decimal @default(0)
|
||||
lostCount Int @default(0)
|
||||
stageConversionRate Decimal?
|
||||
lostReasonDistribution Json @default("{}")
|
||||
isDemoDataIncluded Boolean @default(false)
|
||||
calculatedAt DateTime @default(now())
|
||||
|
||||
@@unique([tenantId, pipelineId, scopeKey])
|
||||
@@index([tenantId, pipelineId])
|
||||
@@index([tenantId, calculatedAt])
|
||||
}
|
||||
|
||||
model ProjektKontakt {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
createdAt DateTime @default(now())
|
||||
projektId String
|
||||
kontaktId String
|
||||
rolle ProjektKontaktRolle
|
||||
primaer Boolean @default(false)
|
||||
|
||||
projekt Projekt @relation(fields: [projektId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([projektId, kontaktId, rolle])
|
||||
@@index([tenantId, projektId])
|
||||
@@index([tenantId, kontaktId])
|
||||
}
|
||||
Reference in new issue
Block a user