Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/prisma/schema/admin.prisma
T
2026-07-08 16:15:37 +02:00

53 lines
2.5 KiB
Plaintext

// AK-P19 — Platform-Admin module (admin.hivegrid.de).
//
// Per AD-21 each module owns its own schema file. The platform-admin
// world is deliberately a *separate* world: these rows carry NO
// `tenant_id`-based RLS scoping of their own beyond a plain FK, because
// admin actions span tenants. Cross-tenant admin actions are recorded
// through the shared AuditEvent Querschnitt (tenantId=null,
// actorType="admin") — NOT a parallel audit table (see AK-P19 plan,
// DoD #7). v1 also reuses the boilerplate User model as the admin
// identity (AdminUser extension + admin-mfa-gate); the separate
// AdminUser/AdminRole/AdminSession identity is v2 (M038/M039).
/// AdminTenantNote — free-form operator notes pinned to a tenant.
/// ENTITY-MODEL Domäne 11: markdown note_text, category, pinned.
/// Written from the admin tenant-detail screen; every write also emits
/// an admin AuditEvent (tenantId=null, actorType="admin").
model AdminTenantNote {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tenantId String
authorUserId String?
noteText String
category String @default("general")
pinned Boolean @default(false)
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
author User? @relation("adminTenantNoteAuthor", fields: [authorUserId], references: [id], onDelete: SetNull)
// Detail view lists pinned-first, newest-first, per tenant.
@@index([tenantId, pinned, createdAt], name: "admin_tenant_note_tenant_pinned_created_idx")
@@index([tenantId, category], name: "admin_tenant_note_tenant_category_idx")
}
/// SupportTicketMessage — conversation thread for the admin Support-Inbox.
/// Extends the existing helpDesk `SupportTicket` (which already carries
/// source/status/priority/tenant) with replies and internal notes.
/// `internalNote=true` rows are operator-only and never surfaced to the
/// tenant. A null author means an inbound message from the customer side.
model SupportTicketMessage {
id String @id @default(cuid())
createdAt DateTime @default(now())
supportTicketId String
authorUserId String?
body String
internalNote Boolean @default(false)
ticket SupportTicket @relation(fields: [supportTicketId], references: [id], onDelete: Cascade)
author User? @relation("supportTicketMessageAuthor", fields: [authorUserId], references: [id], onDelete: SetNull)
@@index([supportTicketId, createdAt], name: "support_ticket_message_ticket_created_idx")
}