@valentine-efagene/qshelter-common 2.0.71 → 2.0.72

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.
@@ -29,6 +29,7 @@ export type * from './models/PropertyPaymentMethod.js';
29
29
  export type * from './models/PropertyPaymentMethodLink.js';
30
30
  export type * from './models/PropertyPaymentMethodPhase.js';
31
31
  export type * from './models/PaymentMethodPhaseStep.js';
32
+ export type * from './models/StepEventAttachment.js';
32
33
  export type * from './models/PaymentMethodPhaseDocument.js';
33
34
  export type * from './models/Contract.js';
34
35
  export type * from './models/ContractPhase.js';
@@ -123,10 +123,10 @@ export declare class WorkflowEventService {
123
123
  id: string;
124
124
  createdAt: Date;
125
125
  status: import("./workflow-types").ExecutionStatus;
126
+ handlerId: string;
126
127
  completedAt: Date | null;
127
128
  error: string | null;
128
129
  eventId: string;
129
- handlerId: string;
130
130
  attempt: number;
131
131
  input: import("@prisma/client/runtime/client").JsonValue | null;
132
132
  output: import("@prisma/client/runtime/client").JsonValue | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valentine-efagene/qshelter-common",
3
- "version": "2.0.71",
3
+ "version": "2.0.72",
4
4
  "description": "Shared database schemas and utilities for QShelter services",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -84,6 +84,15 @@ enum StepStatus {
84
84
  AWAITING_REVIEW // Submitted, waiting for admin/system review
85
85
  }
86
86
 
87
+ /// When a step event attachment should trigger
88
+ enum StepTrigger {
89
+ ON_COMPLETE // When step is approved/completed
90
+ ON_REJECT // When step is rejected
91
+ ON_SUBMIT // When step is submitted for review
92
+ ON_RESUBMIT // When step is resubmitted after rejection
93
+ ON_START // When step transitions to IN_PROGRESS
94
+ }
95
+
87
96
  enum InstallmentStatus {
88
97
  PENDING
89
98
  PAID
@@ -947,10 +956,42 @@ model PaymentMethodPhaseStep {
947
956
  createdAt DateTime @default(now())
948
957
  updatedAt DateTime @updatedAt
949
958
 
959
+ // Event attachments - handlers that fire on step transitions
960
+ eventAttachments StepEventAttachment[]
961
+
950
962
  @@index([phaseId])
951
963
  @@map("payment_method_phase_steps")
952
964
  }
953
965
 
966
+ /// Step Event Attachment - Links event handlers to step template triggers
967
+ /// When a step transitions (complete, reject, etc.), attached handlers fire
968
+ model StepEventAttachment {
969
+ id String @id @default(cuid())
970
+ stepId String
971
+ step PaymentMethodPhaseStep @relation(fields: [stepId], references: [id], onDelete: Cascade)
972
+
973
+ /// When this handler should fire
974
+ trigger StepTrigger
975
+
976
+ /// The event handler to execute
977
+ handlerId String
978
+ handler EventHandler @relation(fields: [handlerId], references: [id], onDelete: Cascade)
979
+
980
+ /// Order of execution (lower = first)
981
+ priority Int @default(100)
982
+
983
+ /// Whether this attachment is active
984
+ enabled Boolean @default(true)
985
+
986
+ createdAt DateTime @default(now())
987
+ updatedAt DateTime @updatedAt
988
+
989
+ @@unique([stepId, handlerId, trigger])
990
+ @@index([stepId])
991
+ @@index([handlerId])
992
+ @@map("step_event_attachments")
993
+ }
994
+
954
995
  // Required document within a DOCUMENTATION phase
955
996
  model PaymentMethodPhaseDocument {
956
997
  id String @id @default(cuid())
@@ -1789,6 +1830,9 @@ model EventHandler {
1789
1830
  /// Handler execution logs
1790
1831
  executions EventHandlerExecution[]
1791
1832
 
1833
+ /// Step attachments - steps that have attached this handler
1834
+ stepAttachments StepEventAttachment[]
1835
+
1792
1836
  createdAt DateTime @default(now())
1793
1837
  updatedAt DateTime @updatedAt
1794
1838