Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/prisma/schema/pipelineHandover.prisma
T

58 lines
2.2 KiB
Plaintext

// WF-P8 M04 (Pipeline-Uebergabe) — records a project's move from one pipeline
// into its successor together with the companion data the salesperson picked.
//
// AD-21: this slice owns its own schema file. `tenantId`, `performedByUserId`
// and the per-item `sourceId` are intentionally bare String scalars so the
// module does not modify core/accounts or the owning P8 `projekt.prisma`
// beyond the additive successor-pipeline field.
//
// The handover is NOT button-triggered: reaching the final stage of the source
// pipeline opens M04, and only "Auswahl uebernehmen" writes this record and
// re-points `Projekt.pipelineId`/`stageId` at the successor pipeline. There is
// no second project row (AD-20: one `Projekt` core, pipelines are views).
/// Which companion entity a handover item carries over. Kept as an enum because
/// the set is closed by the M04 tab strip (Notizen / Dateien / Aufgaben / Termine).
enum PipelineHandoverItemKind {
notiz
datei
aufgabe
termin
}
/// One completed pipeline handover of a single project. Append-only: an undo
/// writes a new `ProjektStageChange`, it does not delete the handover trail.
model PipelineHandover {
id String @id @default(cuid())
tenantId String
createdAt DateTime @default(now())
projektId String
fromPipelineId String
toPipelineId String
fromStageId String
toStageId String
performedByUserId String?
items PipelineHandoverItem[]
@@index([tenantId, projektId, createdAt])
@@index([tenantId, toPipelineId, createdAt])
}
/// A single companion record the user ticked in M04. `sourceId` addresses the
/// note/file/task/appointment; it stays a bare scalar because the four sources
/// live in four different module schemas.
model PipelineHandoverItem {
id String @id @default(cuid())
tenantId String
handoverId String
kind PipelineHandoverItemKind
sourceId String
createdAt DateTime @default(now())
handover PipelineHandover @relation(fields: [handoverId], references: [id], onDelete: Cascade)
@@unique([handoverId, kind, sourceId])
@@index([tenantId, kind, sourceId])
}