@valentine-efagene/qshelter-common 2.0.125 → 2.0.126
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 +5 -0
- package/dist/generated/client/client.d.ts +5 -0
- package/dist/generated/client/commonInputTypes.d.ts +60 -0
- package/dist/generated/client/enums.d.ts +18 -0
- package/dist/generated/client/enums.js +16 -0
- package/dist/generated/client/internal/class.d.ts +11 -0
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +117 -1
- package/dist/generated/client/internal/prismaNamespace.js +40 -1
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +41 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +40 -1
- package/dist/generated/client/models/ApplicationDocument.d.ts +632 -1
- package/dist/generated/client/models/DocumentReview.d.ts +2231 -0
- package/dist/generated/client/models/DocumentReview.js +1 -0
- package/dist/generated/client/models/DocumentationPlanStep.d.ts +61 -1
- package/dist/generated/client/models/DocumentationStep.d.ts +121 -1
- package/dist/generated/client/models/Tenant.d.ts +563 -0
- package/dist/generated/client/models/User.d.ts +401 -0
- package/dist/generated/client/models.d.ts +1 -0
- package/package.json +1 -1
- package/prisma/schema.prisma +115 -0
|
@@ -54,6 +54,7 @@ export type * from './models/DocumentationStepApproval.js';
|
|
|
54
54
|
export type * from './models/PaymentInstallment.js';
|
|
55
55
|
export type * from './models/ApplicationPayment.js';
|
|
56
56
|
export type * from './models/ApplicationDocument.js';
|
|
57
|
+
export type * from './models/DocumentReview.js';
|
|
57
58
|
export type * from './models/DocumentTemplate.js';
|
|
58
59
|
export type * from './models/OfferLetter.js';
|
|
59
60
|
export type * from './models/ApplicationTermination.js';
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -262,6 +262,30 @@ enum CompletionCriterion {
|
|
|
262
262
|
STEPS_COMPLETED
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
// =============================================================================
|
|
266
|
+
// MULTI-PARTY DOCUMENT REVIEW ENUMS
|
|
267
|
+
// =============================================================================
|
|
268
|
+
// Enables different organizations to review the same document independently
|
|
269
|
+
// =============================================================================
|
|
270
|
+
|
|
271
|
+
enum ReviewParty {
|
|
272
|
+
INTERNAL // Your internal team (compliance, underwriting, etc.)
|
|
273
|
+
BANK // Partner bank/lender
|
|
274
|
+
DEVELOPER // Property developer
|
|
275
|
+
LEGAL // Legal team
|
|
276
|
+
GOVERNMENT // Government agencies (e.g., land registry)
|
|
277
|
+
INSURER // Insurance company
|
|
278
|
+
CUSTOMER // Customer acknowledgment/signature
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
enum ReviewDecision {
|
|
282
|
+
PENDING // Review not yet performed
|
|
283
|
+
APPROVED // Document approved by this party
|
|
284
|
+
REJECTED // Document rejected (permanent)
|
|
285
|
+
CHANGES_REQUESTED // Document needs modifications
|
|
286
|
+
WAIVED // Review not required by this party
|
|
287
|
+
}
|
|
288
|
+
|
|
265
289
|
enum DocumentStatus {
|
|
266
290
|
DRAFT
|
|
267
291
|
PENDING
|
|
@@ -460,6 +484,9 @@ model User {
|
|
|
460
484
|
approvedRefunds ApplicationRefund[] @relation("RefundApprover")
|
|
461
485
|
processedRefunds ApplicationRefund[] @relation("RefundProcessor")
|
|
462
486
|
|
|
487
|
+
// Document reviews by this user
|
|
488
|
+
documentReviews DocumentReview[] @relation("DocumentReviewer")
|
|
489
|
+
|
|
463
490
|
// Organization memberships (user can be employee of banks/developers)
|
|
464
491
|
organizationMemberships OrganizationMember[]
|
|
465
492
|
|
|
@@ -747,6 +774,7 @@ model Tenant {
|
|
|
747
774
|
domainEvents DomainEvent[]
|
|
748
775
|
workflowBlockers WorkflowBlocker[]
|
|
749
776
|
questionnairePlans QuestionnairePlan[]
|
|
777
|
+
documentReviews DocumentReview[]
|
|
750
778
|
|
|
751
779
|
// Organizations (Banks, Developers) operating on this tenant
|
|
752
780
|
organizations Organization[]
|
|
@@ -1271,6 +1299,17 @@ model DocumentationPlanStep {
|
|
|
1271
1299
|
// { "all": [{ "questionKey": "has_spouse", "operator": "EQUALS", "value": "YES" }, { "questionKey": "spouse_employed", "operator": "EQUALS", "value": "YES" }] }
|
|
1272
1300
|
condition Json?
|
|
1273
1301
|
|
|
1302
|
+
// =========================================================================
|
|
1303
|
+
// MULTI-PARTY REVIEW CONFIGURATION (for UPLOAD steps)
|
|
1304
|
+
// =========================================================================
|
|
1305
|
+
// Defines which parties must review documents uploaded in this step
|
|
1306
|
+
// Format: [{ party: "INTERNAL", required: true }, { party: "BANK", required: true }]
|
|
1307
|
+
// If null, defaults to single internal review (backward compatible)
|
|
1308
|
+
reviewRequirements Json?
|
|
1309
|
+
|
|
1310
|
+
// Review order: 'SEQUENTIAL' = parties review in order, 'PARALLEL' = all review simultaneously
|
|
1311
|
+
reviewOrder String? // 'SEQUENTIAL' | 'PARALLEL'
|
|
1312
|
+
|
|
1274
1313
|
// =========================================================================
|
|
1275
1314
|
// GATE STEP CONFIGURATION (only applicable when stepType = GATE)
|
|
1276
1315
|
// =========================================================================
|
|
@@ -2290,6 +2329,17 @@ model DocumentationStep {
|
|
|
2290
2329
|
// Or: { "questionKey": "employment_status", "operator": "IN", "values": ["SELF_EMPLOYED", "BUSINESS_OWNER"] }
|
|
2291
2330
|
condition Json?
|
|
2292
2331
|
|
|
2332
|
+
// =========================================================================
|
|
2333
|
+
// MULTI-PARTY REVIEW CONFIGURATION (for UPLOAD steps)
|
|
2334
|
+
// =========================================================================
|
|
2335
|
+
// Defines which parties must review documents uploaded in this step
|
|
2336
|
+
// Format: [{ party: "INTERNAL", required: true }, { party: "BANK", required: true }]
|
|
2337
|
+
// If null, defaults to single internal review (backward compatible)
|
|
2338
|
+
reviewRequirements Json?
|
|
2339
|
+
|
|
2340
|
+
// Review order: 'SEQUENTIAL' = parties review in order, 'PARALLEL' = all review simultaneously
|
|
2341
|
+
reviewOrder String? // 'SEQUENTIAL' | 'PARALLEL'
|
|
2342
|
+
|
|
2293
2343
|
// Assignment
|
|
2294
2344
|
assigneeId String?
|
|
2295
2345
|
assignee User? @relation("DocumentationStepAssignee", fields: [assigneeId], references: [id])
|
|
@@ -2465,18 +2515,83 @@ model ApplicationDocument {
|
|
|
2465
2515
|
|
|
2466
2516
|
status DocumentStatus @default(PENDING)
|
|
2467
2517
|
|
|
2518
|
+
// Document versioning (for re-uploads after changes requested)
|
|
2519
|
+
version Int @default(1)
|
|
2520
|
+
replacesDocumentId String? // If this is a revision, points to original
|
|
2521
|
+
replacesDocument ApplicationDocument? @relation("DocumentRevisions", fields: [replacesDocumentId], references: [id])
|
|
2522
|
+
revisions ApplicationDocument[] @relation("DocumentRevisions")
|
|
2523
|
+
|
|
2468
2524
|
createdAt DateTime @default(now())
|
|
2469
2525
|
updatedAt DateTime @updatedAt
|
|
2470
2526
|
|
|
2527
|
+
// Multi-party reviews for this document
|
|
2528
|
+
reviews DocumentReview[]
|
|
2529
|
+
|
|
2471
2530
|
@@index([tenantId])
|
|
2472
2531
|
@@index([applicationId])
|
|
2473
2532
|
@@index([phaseId])
|
|
2474
2533
|
@@index([stepId])
|
|
2475
2534
|
@@index([type])
|
|
2476
2535
|
@@index([status])
|
|
2536
|
+
@@index([replacesDocumentId])
|
|
2477
2537
|
@@map("application_documents")
|
|
2478
2538
|
}
|
|
2479
2539
|
|
|
2540
|
+
// =============================================================================
|
|
2541
|
+
// DOCUMENT REVIEW - Multi-party review tracking
|
|
2542
|
+
// =============================================================================
|
|
2543
|
+
// Tracks reviews by different organizations for the same document
|
|
2544
|
+
// Enables internal approval -> external approval workflows
|
|
2545
|
+
// =============================================================================
|
|
2546
|
+
|
|
2547
|
+
model DocumentReview {
|
|
2548
|
+
id String @id @default(cuid())
|
|
2549
|
+
tenantId String
|
|
2550
|
+
tenant Tenant @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
|
2551
|
+
documentId String
|
|
2552
|
+
document ApplicationDocument @relation(fields: [documentId], references: [id], onDelete: Cascade)
|
|
2553
|
+
|
|
2554
|
+
// Who is reviewing
|
|
2555
|
+
reviewParty ReviewParty // INTERNAL, BANK, DEVELOPER, LEGAL, etc.
|
|
2556
|
+
organizationId String? // External organization ID if applicable
|
|
2557
|
+
reviewerId String? // User who performed the review
|
|
2558
|
+
reviewer User? @relation("DocumentReviewer", fields: [reviewerId], references: [id])
|
|
2559
|
+
reviewerName String? // Denormalized for audit trail
|
|
2560
|
+
|
|
2561
|
+
// Review state
|
|
2562
|
+
decision ReviewDecision @default(PENDING)
|
|
2563
|
+
comments String? @db.Text // General comments
|
|
2564
|
+
|
|
2565
|
+
// Structured concerns for change requests
|
|
2566
|
+
// Format: [{ field: "income_period", issue: "Missing months April-June" }]
|
|
2567
|
+
concerns Json?
|
|
2568
|
+
|
|
2569
|
+
// Review timing
|
|
2570
|
+
requestedAt DateTime @default(now())
|
|
2571
|
+
dueAt DateTime? // Optional deadline for this party
|
|
2572
|
+
reviewedAt DateTime? // When decision was made
|
|
2573
|
+
|
|
2574
|
+
// Review sequence (which order should parties review?)
|
|
2575
|
+
reviewOrder Int @default(0) // 0 = parallel, 1/2/3 = sequential
|
|
2576
|
+
|
|
2577
|
+
// For review chains (re-reviews after changes)
|
|
2578
|
+
parentReviewId String? // If this is a re-review after changes
|
|
2579
|
+
parentReview DocumentReview? @relation("ReviewChain", fields: [parentReviewId], references: [id])
|
|
2580
|
+
childReviews DocumentReview[] @relation("ReviewChain")
|
|
2581
|
+
|
|
2582
|
+
createdAt DateTime @default(now())
|
|
2583
|
+
updatedAt DateTime @updatedAt
|
|
2584
|
+
|
|
2585
|
+
@@unique([documentId, reviewParty, organizationId]) // One review per party per org per doc
|
|
2586
|
+
@@index([tenantId])
|
|
2587
|
+
@@index([documentId])
|
|
2588
|
+
@@index([reviewParty])
|
|
2589
|
+
@@index([decision])
|
|
2590
|
+
@@index([reviewerId])
|
|
2591
|
+
@@index([parentReviewId])
|
|
2592
|
+
@@map("document_reviews")
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2480
2595
|
// =============================================================================
|
|
2481
2596
|
// OFFER LETTERS - Provisional and Final offer documents
|
|
2482
2597
|
// =============================================================================
|