@valentine-efagene/qshelter-common 2.0.144 → 2.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/client/browser.d.ts +0 -23
- package/dist/generated/client/client.d.ts +0 -23
- package/dist/generated/client/commonInputTypes.d.ts +0 -120
- package/dist/generated/client/enums.d.ts +2 -31
- package/dist/generated/client/enums.js +4 -29
- package/dist/generated/client/internal/class.d.ts +0 -44
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +1 -397
- package/dist/generated/client/internal/prismaNamespace.js +0 -104
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +0 -112
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +0 -104
- package/dist/generated/client/models/EventHandler.d.ts +0 -158
- package/dist/generated/client/models/EventType.d.ts +0 -134
- package/dist/generated/client/models/Tenant.d.ts +115 -1852
- package/dist/generated/client/models/index.d.ts +0 -4
- package/dist/generated/client/models/index.js +0 -4
- package/dist/generated/client/models.d.ts +0 -4
- package/dist/src/prisma/tenant.js +0 -2
- package/package.json +1 -1
- package/prisma/schema.prisma +31 -251
|
@@ -25,7 +25,6 @@ export * from './DomainEvent';
|
|
|
25
25
|
export * from './EmailPreference';
|
|
26
26
|
export * from './EventChannel';
|
|
27
27
|
export * from './EventHandler';
|
|
28
|
-
export * from './EventHandlerExecution';
|
|
29
28
|
export * from './EventType';
|
|
30
29
|
export * from './OAuthState';
|
|
31
30
|
export * from './OfferLetter';
|
|
@@ -64,8 +63,6 @@ export * from './RolePermission';
|
|
|
64
63
|
export * from './ScheduledJob';
|
|
65
64
|
export * from './Settings';
|
|
66
65
|
export * from './Social';
|
|
67
|
-
export * from './StateTransitionDefinition';
|
|
68
|
-
export * from './StateTransitionLog';
|
|
69
66
|
export * from './StepEventAttachment';
|
|
70
67
|
export * from './Tenant';
|
|
71
68
|
export * from './TenantMembership';
|
|
@@ -75,4 +72,3 @@ export * from './UserRole';
|
|
|
75
72
|
export * from './UserSuspension';
|
|
76
73
|
export * from './Wallet';
|
|
77
74
|
export * from './WorkflowBlocker';
|
|
78
|
-
export * from './WorkflowEvent';
|
|
@@ -25,7 +25,6 @@ export * from './DomainEvent';
|
|
|
25
25
|
export * from './EmailPreference';
|
|
26
26
|
export * from './EventChannel';
|
|
27
27
|
export * from './EventHandler';
|
|
28
|
-
export * from './EventHandlerExecution';
|
|
29
28
|
export * from './EventType';
|
|
30
29
|
export * from './OAuthState';
|
|
31
30
|
export * from './OfferLetter';
|
|
@@ -64,8 +63,6 @@ export * from './RolePermission';
|
|
|
64
63
|
export * from './ScheduledJob';
|
|
65
64
|
export * from './Settings';
|
|
66
65
|
export * from './Social';
|
|
67
|
-
export * from './StateTransitionDefinition';
|
|
68
|
-
export * from './StateTransitionLog';
|
|
69
66
|
export * from './StepEventAttachment';
|
|
70
67
|
export * from './Tenant';
|
|
71
68
|
export * from './TenantMembership';
|
|
@@ -75,4 +72,3 @@ export * from './UserRole';
|
|
|
75
72
|
export * from './UserSuspension';
|
|
76
73
|
export * from './Wallet';
|
|
77
74
|
export * from './WorkflowBlocker';
|
|
78
|
-
export * from './WorkflowEvent';
|
|
@@ -66,14 +66,10 @@ export type * from './models/DocumentRequirementRule.js';
|
|
|
66
66
|
export type * from './models/EventChannel.js';
|
|
67
67
|
export type * from './models/EventType.js';
|
|
68
68
|
export type * from './models/EventHandler.js';
|
|
69
|
-
export type * from './models/WorkflowEvent.js';
|
|
70
|
-
export type * from './models/EventHandlerExecution.js';
|
|
71
69
|
export type * from './models/DomainEvent.js';
|
|
72
70
|
export type * from './models/PropertyTransferRequest.js';
|
|
73
71
|
export type * from './models/ApprovalRequest.js';
|
|
74
72
|
export type * from './models/WorkflowBlocker.js';
|
|
75
|
-
export type * from './models/StateTransitionDefinition.js';
|
|
76
|
-
export type * from './models/StateTransitionLog.js';
|
|
77
73
|
export type * from './models/ScheduledJob.js';
|
|
78
74
|
export type * from './models/DocumentExpiryWarning.js';
|
|
79
75
|
export type * from './commonInputTypes.js';
|
|
@@ -38,8 +38,6 @@ const OPTIONAL_TENANT_MODELS = [
|
|
|
38
38
|
"role",
|
|
39
39
|
// Permission can be global template or tenant-specific
|
|
40
40
|
"permission",
|
|
41
|
-
// StateTransitionDefinition can be global template or tenant-specific
|
|
42
|
-
"stateTransitionDefinition",
|
|
43
41
|
// ScheduledJob can be system-wide or tenant-specific
|
|
44
42
|
"scheduledJob",
|
|
45
43
|
];
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -367,6 +367,7 @@ enum ApplicationEventType {
|
|
|
367
367
|
APPLICATION_TRANSFERRED
|
|
368
368
|
UNDERWRITING_COMPLETED
|
|
369
369
|
OFFER_LETTER_GENERATED
|
|
370
|
+
HANDLER_EXECUTED // Event handler was executed
|
|
370
371
|
}
|
|
371
372
|
|
|
372
373
|
enum ApplicationEventGroup {
|
|
@@ -375,6 +376,7 @@ enum ApplicationEventGroup {
|
|
|
375
376
|
DOCUMENT
|
|
376
377
|
NOTIFICATION
|
|
377
378
|
WORKFLOW
|
|
379
|
+
AUTOMATION // Automated handler executions
|
|
378
380
|
}
|
|
379
381
|
|
|
380
382
|
enum EventActorType {
|
|
@@ -410,33 +412,6 @@ enum EventHandlerType {
|
|
|
410
412
|
LOCK_UNIT // Lock the property unit for the applicant, supersede competing applications
|
|
411
413
|
}
|
|
412
414
|
|
|
413
|
-
/// Actor Type - Who triggered an event
|
|
414
|
-
enum ActorType {
|
|
415
|
-
USER
|
|
416
|
-
API_KEY
|
|
417
|
-
SYSTEM
|
|
418
|
-
WEBHOOK
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/// Workflow Event Status
|
|
422
|
-
enum WorkflowEventStatus {
|
|
423
|
-
PENDING
|
|
424
|
-
PROCESSING
|
|
425
|
-
COMPLETED
|
|
426
|
-
FAILED
|
|
427
|
-
SKIPPED
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/// Handler Execution Status
|
|
431
|
-
enum ExecutionStatus {
|
|
432
|
-
PENDING
|
|
433
|
-
RUNNING
|
|
434
|
-
COMPLETED
|
|
435
|
-
FAILED
|
|
436
|
-
RETRYING
|
|
437
|
-
SKIPPED
|
|
438
|
-
}
|
|
439
|
-
|
|
440
415
|
/// Permission effect (Allow/Deny)
|
|
441
416
|
enum PermissionEffect {
|
|
442
417
|
ALLOW
|
|
@@ -848,10 +823,9 @@ model Tenant {
|
|
|
848
823
|
apiKeys ApiKey[]
|
|
849
824
|
|
|
850
825
|
// Event-driven workflow
|
|
851
|
-
eventChannels
|
|
852
|
-
eventTypes
|
|
853
|
-
eventHandlers
|
|
854
|
-
workflowEvents WorkflowEvent[]
|
|
826
|
+
eventChannels EventChannel[]
|
|
827
|
+
eventTypes EventType[]
|
|
828
|
+
eventHandlers EventHandler[]
|
|
855
829
|
|
|
856
830
|
// Property transfer requests
|
|
857
831
|
propertyTransferRequests PropertyTransferRequest[]
|
|
@@ -886,7 +860,6 @@ model Tenant {
|
|
|
886
860
|
propertyVariantMedia PropertyVariantMedia[]
|
|
887
861
|
propertyUnits PropertyUnit[]
|
|
888
862
|
propertyAmenities PropertyAmenity[]
|
|
889
|
-
eventHandlerExecutions EventHandlerExecution[]
|
|
890
863
|
amenities Amenity[]
|
|
891
864
|
socials Social[]
|
|
892
865
|
wallets Wallet[]
|
|
@@ -907,9 +880,6 @@ model Tenant {
|
|
|
907
880
|
// Application organization assignments
|
|
908
881
|
applicationOrganizations ApplicationOrganization[]
|
|
909
882
|
|
|
910
|
-
// State machine audit
|
|
911
|
-
stateTransitionLogs StateTransitionLog[]
|
|
912
|
-
|
|
913
883
|
@@index([subdomain])
|
|
914
884
|
@@map("tenants")
|
|
915
885
|
}
|
|
@@ -2143,16 +2113,16 @@ model ApplicationOrganization {
|
|
|
2143
2113
|
isPrimary Boolean @default(false)
|
|
2144
2114
|
|
|
2145
2115
|
// Organization-specific terms (e.g., bank's offered interest rate)
|
|
2146
|
-
offeredTerms
|
|
2147
|
-
termsOfferedAt
|
|
2148
|
-
termsAcceptedAt
|
|
2149
|
-
termsDeclinedAt
|
|
2150
|
-
declineReason
|
|
2116
|
+
offeredTerms Json? // { interestRate, termMonths, conditions, etc. }
|
|
2117
|
+
termsOfferedAt DateTime?
|
|
2118
|
+
termsAcceptedAt DateTime?
|
|
2119
|
+
termsDeclinedAt DateTime?
|
|
2120
|
+
declineReason String? @db.Text
|
|
2151
2121
|
|
|
2152
2122
|
// Tracking
|
|
2153
|
-
activatedAt
|
|
2154
|
-
completedAt
|
|
2155
|
-
withdrawnAt
|
|
2123
|
+
activatedAt DateTime?
|
|
2124
|
+
completedAt DateTime?
|
|
2125
|
+
withdrawnAt DateTime?
|
|
2156
2126
|
|
|
2157
2127
|
// =========================================================================
|
|
2158
2128
|
// SLA TRACKING - Monitor bank responsiveness
|
|
@@ -2160,19 +2130,19 @@ model ApplicationOrganization {
|
|
|
2160
2130
|
// When documentation is complete, clock starts for bank to respond.
|
|
2161
2131
|
// If they're slow, admin can reassign to another bank.
|
|
2162
2132
|
// =========================================================================
|
|
2163
|
-
slaHours
|
|
2164
|
-
slaStartedAt
|
|
2165
|
-
slaBreachedAt
|
|
2166
|
-
slaBreachNotified
|
|
2167
|
-
|
|
2133
|
+
slaHours Int? // Expected response time (e.g., 48 hours)
|
|
2134
|
+
slaStartedAt DateTime? // When clock started (e.g., when docs were complete)
|
|
2135
|
+
slaBreachedAt DateTime? // When SLA was breached (set by cron job)
|
|
2136
|
+
slaBreachNotified Boolean @default(false) // Was admin notified of breach?
|
|
2137
|
+
|
|
2168
2138
|
// Reminder tracking
|
|
2169
2139
|
reminderCount Int @default(0)
|
|
2170
2140
|
lastReminderSentAt DateTime?
|
|
2171
2141
|
nextReminderAt DateTime?
|
|
2172
|
-
|
|
2142
|
+
|
|
2173
2143
|
// Escalation
|
|
2174
2144
|
escalatedAt DateTime?
|
|
2175
|
-
escalatedToUserId String?
|
|
2145
|
+
escalatedToUserId String? // Admin handling the escalation
|
|
2176
2146
|
escalationNotes String? @db.Text
|
|
2177
2147
|
|
|
2178
2148
|
createdAt DateTime @default(now())
|
|
@@ -2690,7 +2660,7 @@ model ApplicationDocument {
|
|
|
2690
2660
|
// =========================================================================
|
|
2691
2661
|
// expectedUploader is set from DocumentDefinition.uploadedBy at phase creation
|
|
2692
2662
|
// Allows validation that correct party is uploading (e.g., developer uploads sales offer)
|
|
2693
|
-
expectedUploader
|
|
2663
|
+
expectedUploader UploadedBy? // CUSTOMER, LENDER, DEVELOPER, LEGAL, PLATFORM, etc.
|
|
2694
2664
|
// If expectedUploader is LENDER/DEVELOPER, track which org should upload
|
|
2695
2665
|
expectedOrganizationId String?
|
|
2696
2666
|
|
|
@@ -2700,13 +2670,13 @@ model ApplicationDocument {
|
|
|
2700
2670
|
// Documents like bank statements have a shelf life. If application takes too long,
|
|
2701
2671
|
// documents may need to be re-uploaded.
|
|
2702
2672
|
// =========================================================================
|
|
2703
|
-
documentDate
|
|
2704
|
-
expiresAt
|
|
2705
|
-
expiryDays
|
|
2706
|
-
isExpired
|
|
2707
|
-
expiredAt
|
|
2708
|
-
expiryWarningAt
|
|
2709
|
-
revalidatedAt
|
|
2673
|
+
documentDate DateTime? // When the document was issued/created (e.g., bank statement date)
|
|
2674
|
+
expiresAt DateTime? // When this document expires (computed from documentDate + expiryDays)
|
|
2675
|
+
expiryDays Int? // Number of days this document type is valid (copied from DocumentDefinition)
|
|
2676
|
+
isExpired Boolean @default(false) // Denormalized flag, updated by cron job
|
|
2677
|
+
expiredAt DateTime? // When the document was marked expired
|
|
2678
|
+
expiryWarningAt DateTime? // When expiry warning was sent
|
|
2679
|
+
revalidatedAt DateTime? // If document was re-uploaded after expiry
|
|
2710
2680
|
|
|
2711
2681
|
status DocumentStatus @default(PENDING)
|
|
2712
2682
|
|
|
@@ -3265,9 +3235,6 @@ model EventType {
|
|
|
3265
3235
|
/// Handlers subscribed to this event type
|
|
3266
3236
|
handlers EventHandler[]
|
|
3267
3237
|
|
|
3268
|
-
/// Actual event instances of this type
|
|
3269
|
-
events WorkflowEvent[]
|
|
3270
|
-
|
|
3271
3238
|
createdAt DateTime @default(now())
|
|
3272
3239
|
updatedAt DateTime @updatedAt
|
|
3273
3240
|
|
|
@@ -3318,9 +3285,6 @@ model EventHandler {
|
|
|
3318
3285
|
/// e.g., "$.payload.status == 'approved'"
|
|
3319
3286
|
filterCondition String? @db.Text
|
|
3320
3287
|
|
|
3321
|
-
/// Handler execution logs
|
|
3322
|
-
executions EventHandlerExecution[]
|
|
3323
|
-
|
|
3324
3288
|
/// Step attachments - steps that have attached this handler
|
|
3325
3289
|
stepAttachments StepEventAttachment[]
|
|
3326
3290
|
|
|
@@ -3336,100 +3300,6 @@ model EventHandler {
|
|
|
3336
3300
|
@@map("event_handlers")
|
|
3337
3301
|
}
|
|
3338
3302
|
|
|
3339
|
-
/// Workflow Event - An actual event instance that occurred
|
|
3340
|
-
/// This is the audit log of all events in the system
|
|
3341
|
-
model WorkflowEvent {
|
|
3342
|
-
id String @id @default(cuid())
|
|
3343
|
-
tenantId String
|
|
3344
|
-
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
3345
|
-
|
|
3346
|
-
/// The type of this event
|
|
3347
|
-
eventTypeId String
|
|
3348
|
-
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
|
|
3349
|
-
|
|
3350
|
-
/// The event payload (actual data)
|
|
3351
|
-
payload Json
|
|
3352
|
-
|
|
3353
|
-
/// Optional correlation ID to link related events
|
|
3354
|
-
correlationId String?
|
|
3355
|
-
|
|
3356
|
-
/// Optional causation ID (which event caused this one)
|
|
3357
|
-
causationId String?
|
|
3358
|
-
|
|
3359
|
-
/// Source of the event (service name, user action, etc.)
|
|
3360
|
-
source String
|
|
3361
|
-
|
|
3362
|
-
/// Actor who triggered the event (user ID, API key ID, "system")
|
|
3363
|
-
actorId String?
|
|
3364
|
-
actorType ActorType @default(SYSTEM)
|
|
3365
|
-
|
|
3366
|
-
/// Event status
|
|
3367
|
-
status WorkflowEventStatus @default(PENDING)
|
|
3368
|
-
|
|
3369
|
-
/// Error message if processing failed
|
|
3370
|
-
error String? @db.Text
|
|
3371
|
-
|
|
3372
|
-
/// When the event was processed
|
|
3373
|
-
processedAt DateTime?
|
|
3374
|
-
|
|
3375
|
-
/// Handler executions for this event
|
|
3376
|
-
executions EventHandlerExecution[]
|
|
3377
|
-
|
|
3378
|
-
createdAt DateTime @default(now())
|
|
3379
|
-
|
|
3380
|
-
@@index([tenantId])
|
|
3381
|
-
@@index([eventTypeId])
|
|
3382
|
-
@@index([correlationId])
|
|
3383
|
-
@@index([causationId])
|
|
3384
|
-
@@index([status])
|
|
3385
|
-
@@index([createdAt])
|
|
3386
|
-
@@map("workflow_events")
|
|
3387
|
-
}
|
|
3388
|
-
|
|
3389
|
-
/// Event Handler Execution - Log of a handler processing an event
|
|
3390
|
-
model EventHandlerExecution {
|
|
3391
|
-
id String @id @default(cuid())
|
|
3392
|
-
tenantId String
|
|
3393
|
-
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
3394
|
-
|
|
3395
|
-
/// The event being processed
|
|
3396
|
-
eventId String
|
|
3397
|
-
event WorkflowEvent @relation(fields: [eventId], references: [id], onDelete: Cascade)
|
|
3398
|
-
|
|
3399
|
-
/// The handler that processed this event
|
|
3400
|
-
handlerId String
|
|
3401
|
-
handler EventHandler @relation(fields: [handlerId], references: [id], onDelete: Cascade)
|
|
3402
|
-
|
|
3403
|
-
/// Execution status
|
|
3404
|
-
status ExecutionStatus @default(PENDING)
|
|
3405
|
-
|
|
3406
|
-
/// Attempt number (1 for first try, increments on retry)
|
|
3407
|
-
attempt Int @default(1)
|
|
3408
|
-
|
|
3409
|
-
/// Input to the handler (may be transformed payload)
|
|
3410
|
-
input Json?
|
|
3411
|
-
|
|
3412
|
-
/// Output from the handler
|
|
3413
|
-
output Json?
|
|
3414
|
-
|
|
3415
|
-
/// Error details if failed
|
|
3416
|
-
error String? @db.Text
|
|
3417
|
-
errorCode String?
|
|
3418
|
-
|
|
3419
|
-
/// Timing
|
|
3420
|
-
startedAt DateTime?
|
|
3421
|
-
completedAt DateTime?
|
|
3422
|
-
durationMs Int?
|
|
3423
|
-
|
|
3424
|
-
createdAt DateTime @default(now())
|
|
3425
|
-
|
|
3426
|
-
@@index([tenantId])
|
|
3427
|
-
@@index([eventId])
|
|
3428
|
-
@@index([handlerId])
|
|
3429
|
-
@@index([status])
|
|
3430
|
-
@@map("event_handler_executions")
|
|
3431
|
-
}
|
|
3432
|
-
|
|
3433
3303
|
// =============================================================================
|
|
3434
3304
|
// EVENT OUTBOX - For guaranteed event delivery to SQS queues
|
|
3435
3305
|
// =============================================================================
|
|
@@ -3737,96 +3607,6 @@ model WorkflowBlocker {
|
|
|
3737
3607
|
@@map("workflow_blockers")
|
|
3738
3608
|
}
|
|
3739
3609
|
|
|
3740
|
-
// =============================================================================
|
|
3741
|
-
// STATE MACHINE DEFINITION - Explicit state transitions
|
|
3742
|
-
// =============================================================================
|
|
3743
|
-
// Defines valid state transitions for applications and phases.
|
|
3744
|
-
// This makes the state machine configurable and auditable, rather than
|
|
3745
|
-
// being hard-coded in service logic.
|
|
3746
|
-
// =============================================================================
|
|
3747
|
-
|
|
3748
|
-
/// Entity type that has state machine behavior
|
|
3749
|
-
enum StateMachineEntity {
|
|
3750
|
-
APPLICATION
|
|
3751
|
-
APPLICATION_PHASE
|
|
3752
|
-
DOCUMENTATION_STAGE
|
|
3753
|
-
DOCUMENT
|
|
3754
|
-
}
|
|
3755
|
-
|
|
3756
|
-
/// State Machine Transition Definition - Configurable state transitions
|
|
3757
|
-
/// Allows admins to customize workflows without code changes
|
|
3758
|
-
model StateTransitionDefinition {
|
|
3759
|
-
id String @id @default(cuid())
|
|
3760
|
-
tenantId String? // NULL = global template, set = tenant-specific override
|
|
3761
|
-
|
|
3762
|
-
// What entity this transition applies to
|
|
3763
|
-
entityType StateMachineEntity
|
|
3764
|
-
|
|
3765
|
-
// The transition
|
|
3766
|
-
fromState String // e.g., "DRAFT", "PENDING", "IN_PROGRESS"
|
|
3767
|
-
toState String // e.g., "ACTIVE", "COMPLETED"
|
|
3768
|
-
trigger String // e.g., "SUBMIT", "APPROVE", "COMPLETE"
|
|
3769
|
-
|
|
3770
|
-
// Transition constraints
|
|
3771
|
-
isEnabled Boolean @default(true)
|
|
3772
|
-
requiresRole String? // Role required to trigger this transition
|
|
3773
|
-
requiresPhase String? // Phase type required (for APPLICATION transitions)
|
|
3774
|
-
|
|
3775
|
-
// Side effects configuration
|
|
3776
|
-
sideEffects Json? // [{ type: "SEND_EMAIL", config: {...} }, { type: "LOCK_UNIT" }]
|
|
3777
|
-
|
|
3778
|
-
// Audit
|
|
3779
|
-
description String? @db.Text
|
|
3780
|
-
createdAt DateTime @default(now())
|
|
3781
|
-
updatedAt DateTime @updatedAt
|
|
3782
|
-
|
|
3783
|
-
@@unique([tenantId, entityType, fromState, trigger])
|
|
3784
|
-
@@index([entityType])
|
|
3785
|
-
@@index([fromState])
|
|
3786
|
-
@@index([trigger])
|
|
3787
|
-
@@map("state_transition_definitions")
|
|
3788
|
-
}
|
|
3789
|
-
|
|
3790
|
-
/// State Transition Log - Audit trail for all state changes
|
|
3791
|
-
/// Records every state transition for compliance and debugging
|
|
3792
|
-
model StateTransitionLog {
|
|
3793
|
-
id String @id @default(cuid())
|
|
3794
|
-
tenantId String
|
|
3795
|
-
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
3796
|
-
|
|
3797
|
-
// What entity changed state
|
|
3798
|
-
entityType StateMachineEntity
|
|
3799
|
-
entityId String // Application ID, Phase ID, Document ID, etc.
|
|
3800
|
-
|
|
3801
|
-
// The transition that occurred
|
|
3802
|
-
fromState String
|
|
3803
|
-
toState String
|
|
3804
|
-
trigger String
|
|
3805
|
-
|
|
3806
|
-
// Who triggered the transition
|
|
3807
|
-
actorId String?
|
|
3808
|
-
actorType EventActorType?
|
|
3809
|
-
|
|
3810
|
-
// Context at time of transition
|
|
3811
|
-
contextSnapshot Json? // Relevant data at time of transition (phase data, payment amounts, etc.)
|
|
3812
|
-
|
|
3813
|
-
// Timing
|
|
3814
|
-
occurredAt DateTime @default(now())
|
|
3815
|
-
durationMs Int? // How long the entity was in fromState
|
|
3816
|
-
|
|
3817
|
-
// Validation
|
|
3818
|
-
wasValid Boolean @default(true) // Was this a valid transition per state machine?
|
|
3819
|
-
errorMessage String? @db.Text // If invalid, why?
|
|
3820
|
-
|
|
3821
|
-
@@index([tenantId])
|
|
3822
|
-
@@index([entityType, entityId])
|
|
3823
|
-
@@index([entityType, fromState])
|
|
3824
|
-
@@index([entityType, toState])
|
|
3825
|
-
@@index([occurredAt])
|
|
3826
|
-
@@index([actorId])
|
|
3827
|
-
@@map("state_transition_logs")
|
|
3828
|
-
}
|
|
3829
|
-
|
|
3830
3610
|
// =============================================================================
|
|
3831
3611
|
// DOCUMENT EXPIRY JOB - Scheduled job tracking for document expiration checks
|
|
3832
3612
|
// =============================================================================
|
|
@@ -3857,7 +3637,7 @@ enum ScheduledJobType {
|
|
|
3857
3637
|
|
|
3858
3638
|
/// Scheduled Job - Tracks execution of background jobs
|
|
3859
3639
|
model ScheduledJob {
|
|
3860
|
-
id String
|
|
3640
|
+
id String @id @default(cuid())
|
|
3861
3641
|
tenantId String? // NULL = system-wide job, set = tenant-specific
|
|
3862
3642
|
|
|
3863
3643
|
jobType ScheduledJobType
|
|
@@ -3902,8 +3682,8 @@ model DocumentExpiryWarning {
|
|
|
3902
3682
|
documentId String
|
|
3903
3683
|
|
|
3904
3684
|
// Warning details
|
|
3905
|
-
expiresAt
|
|
3906
|
-
daysUntil
|
|
3685
|
+
expiresAt DateTime // When document will expire
|
|
3686
|
+
daysUntil Int // Days until expiry at time of warning
|
|
3907
3687
|
warningSent DateTime @default(now())
|
|
3908
3688
|
|
|
3909
3689
|
// Customer notification tracking
|