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

@@ -2,6 +2,8 @@ model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
/// Stored normalized for new writes. A functional lower(trim(email))
/// unique index in migration SQL also protects legacy mixed-case rows.
email String @unique
passwordHash String?
firstName String
@@ -34,7 +36,6 @@ model User {
pseudonymized Boolean @default(false)
pseudonymizedAt DateTime?
deletionRequestId String? @unique
admin AdminUser? // Has access to the admin panel
createdApiKeys ApiKey[]
createdGroups Group[]
groups GroupUser[]
@@ -59,8 +60,6 @@ model User {
feedback Feedback[]
supportTickets SupportTicket[]
assignedSupportTickets SupportTicket[] @relation("supportTicketAssignee")
supportTicketMessages SupportTicketMessage[] @relation("supportTicketMessageAuthor")
adminTenantNotesAuthored AdminTenantNote[] @relation("adminTenantNoteAuthor")
credits Credit[]
portals Portal[]
impersonationAuditsActor ImpersonationAudit[] @relation("ImpersonationAuditActor")
@@ -95,24 +94,6 @@ model MagicLinkToken {
@@index([expiresAt, consumedAt])
}
// Has access to the admin panel
model AdminUser {
userId String @id @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// Phase 09 #82 — OIDC SSO link to external IdP (Authentik).
// ssoProvider / ssoSubjectId together identify the federated identity
// (typically `authentik` + the IdP-stable `sub` claim). Both nullable so
// legacy bootstrap admins predating SSO continue to function.
ssoProvider String?
ssoSubjectId String?
ssoGroups String[] @default([])
lastSsoLoginAt DateTime?
@@unique([ssoProvider, ssoSubjectId])
@@index([ssoSubjectId])
}
model Tenant {
id String @id @default(cuid())
createdAt DateTime @default(now())
@@ -126,6 +107,7 @@ model Tenant {
deactivatedReason String?
apiKeys ApiKey[]
apiKeyLogs ApiKeyLog[]
idempotencyKeys IdempotencyKey[]
groups Group[]
logs Log[]
subscription TenantSubscription?
@@ -146,7 +128,6 @@ model Tenant {
ipAddresses TenantIpAddress[]
metricLogs MetricLog[]
knowledgeBases KnowledgeBase[]
types TenantType[]
workflows Workflow[]
workflowExecutions WorkflowExecution[]
workflowVariables WorkflowVariable[]
@@ -154,6 +135,8 @@ model Tenant {
feedback Feedback[]
supportTickets SupportTicket[]
credits Credit[]
checkoutSessions CheckoutSessionStatus[]
productAcquisitions TenantProductAcquisition[]
portals Portal[]
portalsUsers PortalUser[]
widgets Widget[]
@@ -227,16 +210,27 @@ model ImpersonationAudit {
@@index([createdAt])
}
// Seat billing bucket / default UI mode. `office` = back-office / desk work,
// `field` = on-site (Baustelle) work. Shared across the Prisma schema folder
// (Role.seatCategory, TenantUser.seatType).
enum SeatType {
office
field
}
model TenantUser {
id String @id @default(cuid())
createdAt DateTime @default(now())
id String @id @default(cuid())
createdAt DateTime @default(now())
tenantId String
userId String
type Int
joined Int
status Int
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// null = derived from the user's roles at read time (any office role => office
// seat); an explicit value is an admin billing override.
seatType SeatType?
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([tenantId, userId])
@@index([userId])
@@ -267,6 +261,9 @@ model TenantUserInvitation {
revokedByUser User? @relation(name: "revokedByUser", fields: [revokedByUserId], references: [id])
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
/// One live pending invite per tenant and normalized email is enforced by a
/// partial functional index in migration SQL. A second partial unique index
/// protects every non-null token hash globally. Prisma cannot declare either.
@@index([tenantId, status, expiresAt])
@@index([tenantId, email, status])
@@index([tenantId, tokenPrefix])
@@ -285,6 +282,8 @@ model Registration {
ipAddress String?
company String?
selectedSubscriptionPriceId String?
selectedOfficeSeatQuantity Int?
selectedFieldSeatQuantity Int?
leadConversionLeadId String?
leadConversionToken String?
leadConversionPlanId String?
@@ -315,15 +314,3 @@ model TenantIpAddress {
@@unique([tenantId, ip, userId, apiKeyId])
}
model TenantType {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String @unique
titlePlural String
description String?
isDefault Boolean @default(false)
tenants Tenant[]
subscriptionProducts SubscriptionProduct[]
}