Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/// Actor that produced an activity. Small closed set → enum.
|
||||
enum ActivityActorKind {
|
||||
user
|
||||
system
|
||||
automation
|
||||
ki_agent
|
||||
}
|
||||
|
||||
/// User-facing business activity timeline (M045 / M01 Block E).
|
||||
///
|
||||
/// DISTINCT from the tamper-evident, hash-chained `AuditEvent` (M001): `Activity`
|
||||
/// is the per-entity, human-readable stream shown to tenant users (calls, notes,
|
||||
/// emails, status changes, …). Every writing module appends here via
|
||||
/// `logActivity()` from `@hivegrid/activity` (AGENTS DoD #14).
|
||||
///
|
||||
/// `activityType` and `subjectType` are stored as strings (extensible per module —
|
||||
/// see the `ActivityType` / `ActivitySubjectType` unions in `@hivegrid/activity`),
|
||||
/// not Prisma enums, to avoid a schema migration for every new module event.
|
||||
///
|
||||
/// Tenant isolation: RLS policy is added with M27 (Auth/Tenancy); until then access
|
||||
/// is App-Level-scoped via the tenant-scoped query helpers.
|
||||
model Activity {
|
||||
id String @id @default(cuid())
|
||||
tenantId String
|
||||
createdAt DateTime @default(now())
|
||||
actorUserId String?
|
||||
actorKind ActivityActorKind
|
||||
activityType String
|
||||
subjectType String
|
||||
subjectId String
|
||||
relatedEntityRefs Json?
|
||||
metadata Json?
|
||||
summaryText String
|
||||
|
||||
// Per-entity timeline (default view), tenant-wide stream, and type filter.
|
||||
@@index([tenantId, subjectType, subjectId, createdAt])
|
||||
@@index([tenantId, createdAt])
|
||||
@@index([tenantId, activityType])
|
||||
}
|
||||
Reference in new issue
Block a user