@dynamatix/gb-schemas 2.3.237 → 2.3.239

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.
Files changed (252) hide show
  1. package/README.md +309 -0
  2. package/dist/applicants/applicant-additional-income.model.d.ts +13 -12
  3. package/dist/applicants/applicant-additional-income.model.d.ts.map +1 -1
  4. package/dist/applicants/applicant-additional-income.model.js +3 -0
  5. package/dist/applicants/applicant-commitment-creditCard.model.d.ts +19 -18
  6. package/dist/applicants/applicant-commitment-creditCard.model.d.ts.map +1 -1
  7. package/dist/applicants/applicant-commitment-creditCard.model.js +3 -0
  8. package/dist/applicants/applicant-commitment-loan.model.d.ts +19 -18
  9. package/dist/applicants/applicant-commitment-loan.model.d.ts.map +1 -1
  10. package/dist/applicants/applicant-commitment-loan.model.js +3 -0
  11. package/dist/applicants/applicant-commitment-mortgage.model.d.ts +19 -18
  12. package/dist/applicants/applicant-commitment-mortgage.model.d.ts.map +1 -1
  13. package/dist/applicants/applicant-commitment-mortgage.model.js +3 -0
  14. package/dist/applicants/applicant-commitment-residence.model.d.ts +31 -30
  15. package/dist/applicants/applicant-commitment-residence.model.d.ts.map +1 -1
  16. package/dist/applicants/applicant-commitment-residence.model.js +3 -0
  17. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts +19 -18
  18. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts.map +1 -1
  19. package/dist/applicants/applicant-commitment-secureLoan.model.js +3 -0
  20. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts +19 -18
  21. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts.map +1 -1
  22. package/dist/applicants/applicant-commitment-unsecuredLoan.model.js +3 -0
  23. package/dist/applicants/applicant-credit-data.model.d.ts +3 -3
  24. package/dist/applicants/applicant-credit-report.model.d.ts +3754 -0
  25. package/dist/applicants/{applicant-income.model.d.ts.map → applicant-credit-report.model.d.ts.map} +1 -1
  26. package/dist/applicants/applicant-credit-report.model.js +116 -0
  27. package/dist/applicants/applicant-credit-report.type.d.ts +140 -0
  28. package/dist/applicants/applicant-credit-report.type.d.ts.map +1 -0
  29. package/dist/applicants/applicant-credit-report.type.js +1 -0
  30. package/dist/applicants/applicant-employment-income.model.d.ts +7 -6
  31. package/dist/applicants/applicant-employment-income.model.d.ts.map +1 -1
  32. package/dist/applicants/applicant-employment-income.model.js +3 -0
  33. package/dist/applicants/applicant-employment.model.d.ts +88 -87
  34. package/dist/applicants/applicant-employment.model.d.ts.map +1 -1
  35. package/dist/applicants/applicant-employment.model.js +19 -19
  36. package/dist/applicants/applicant-expenditure.model.d.ts +7 -0
  37. package/dist/applicants/applicant-expenditure.model.d.ts.map +1 -1
  38. package/dist/applicants/applicant-expenditure.model.js +77 -0
  39. package/dist/applicants/applicant-expenditure.type.d.ts +42 -0
  40. package/dist/applicants/applicant-expenditure.type.d.ts.map +1 -0
  41. package/dist/applicants/applicant-expenditure.type.js +1 -0
  42. package/dist/applicants/applicant-income-settings.model.d.ts.map +1 -1
  43. package/dist/applicants/applicant-income-settings.model.js +3 -0
  44. package/dist/applicants/applicant-income-settings.type.d.ts +40 -0
  45. package/dist/applicants/applicant-income-settings.type.d.ts.map +1 -0
  46. package/dist/applicants/applicant-income-settings.type.js +1 -0
  47. package/dist/applicants/applicant-income-summary.model.d.ts +73 -72
  48. package/dist/applicants/applicant-income-summary.model.d.ts.map +1 -1
  49. package/dist/applicants/applicant-income-summary.model.js +3 -0
  50. package/dist/applicants/applicant-income-summary.type.d.ts +60 -0
  51. package/dist/applicants/applicant-income-summary.type.d.ts.map +1 -0
  52. package/dist/applicants/applicant-income-summary.type.js +1 -0
  53. package/dist/applicants/applicant-pension-income.model.d.ts +19 -18
  54. package/dist/applicants/applicant-pension-income.model.d.ts.map +1 -1
  55. package/dist/applicants/applicant-pension-income.model.js +3 -0
  56. package/dist/applicants/applicant-pension-income.type.d.ts +40 -0
  57. package/dist/applicants/applicant-pension-income.type.d.ts.map +1 -0
  58. package/dist/applicants/applicant-pension-income.type.js +1 -0
  59. package/dist/applicants/applicant-property-income.model.d.ts +37 -36
  60. package/dist/applicants/applicant-property-income.model.d.ts.map +1 -1
  61. package/dist/applicants/applicant-property-income.model.js +3 -0
  62. package/dist/applicants/applicant-self-employed-income.model.d.ts +7 -6
  63. package/dist/applicants/applicant-self-employed-income.model.d.ts.map +1 -1
  64. package/dist/applicants/applicant-self-employed-income.model.js +3 -0
  65. package/dist/applicants/applicant-self-employed-income.type.d.ts +37 -0
  66. package/dist/applicants/applicant-self-employed-income.type.d.ts.map +1 -0
  67. package/dist/applicants/applicant-self-employed-income.type.js +1 -0
  68. package/dist/applicants/applicant-self-employment.model.d.ts +6 -6
  69. package/dist/applicants/applicant-self-employment.model.d.ts.map +1 -1
  70. package/dist/applicants/applicant-self-employment.model.js +4 -1
  71. package/dist/applicants/applicant-sole-trader-income.model.d.ts +7 -6
  72. package/dist/applicants/applicant-sole-trader-income.model.d.ts.map +1 -1
  73. package/dist/applicants/applicant-sole-trader-income.model.js +3 -0
  74. package/dist/applicants/applicant-sole-trader-income.type.d.ts +37 -0
  75. package/dist/applicants/applicant-sole-trader-income.type.d.ts.map +1 -0
  76. package/dist/applicants/applicant-sole-trader-income.type.js +1 -0
  77. package/dist/applicants/applicant-uk-tax-credits.model.d.ts +19 -18
  78. package/dist/applicants/applicant-uk-tax-credits.model.d.ts.map +1 -1
  79. package/dist/applicants/applicant-uk-tax-credits.model.js +3 -0
  80. package/dist/applicants/applicant-uk-tax-credits.type.d.ts +39 -0
  81. package/dist/applicants/applicant-uk-tax-credits.type.d.ts.map +1 -0
  82. package/dist/applicants/applicant-uk-tax-credits.type.js +1 -0
  83. package/dist/applicants/applicant-welcome-call.model.d.ts +288 -0
  84. package/dist/applicants/applicant-welcome-call.model.d.ts.map +1 -0
  85. package/dist/applicants/applicant-welcome-call.model.js +263 -0
  86. package/dist/applicants/applicant-welcome-call.type.d.ts +66 -0
  87. package/dist/applicants/applicant-welcome-call.type.d.ts.map +1 -0
  88. package/dist/applicants/applicant-welcome-call.type.js +1 -0
  89. package/dist/applicants/applicant.model.d.ts +49 -42
  90. package/dist/applicants/applicant.model.d.ts.map +1 -1
  91. package/dist/applicants/applicant.model.js +5 -1
  92. package/dist/applicants/applicant.type.d.ts +158 -0
  93. package/dist/applicants/applicant.type.d.ts.map +1 -0
  94. package/dist/applicants/applicant.type.js +1 -0
  95. package/dist/applicants/index.d.ts +14 -0
  96. package/dist/applicants/index.d.ts.map +1 -1
  97. package/dist/applicants/index.js +2 -0
  98. package/dist/applications/application-audit.model.d.ts +6 -6
  99. package/dist/applications/application-audit.model.d.ts.map +1 -1
  100. package/dist/applications/application-audit.model.js +3 -0
  101. package/dist/applications/application-checklist-Item.model.d.ts +6 -0
  102. package/dist/applications/application-checklist-Item.model.d.ts.map +1 -1
  103. package/dist/applications/application-checklist-Item.model.js +4 -0
  104. package/dist/applications/application-company-model.d.ts +64 -57
  105. package/dist/applications/application-company-model.d.ts.map +1 -1
  106. package/dist/applications/application-company-model.js +1 -0
  107. package/dist/applications/application-direct-debit.model.d.ts +29 -27
  108. package/dist/applications/application-direct-debit.model.d.ts.map +1 -1
  109. package/dist/applications/application-direct-debit.model.js +3 -0
  110. package/dist/applications/application-euc.model.d.ts.map +1 -1
  111. package/dist/applications/application-euc.model.js +3 -0
  112. package/dist/applications/application-fieldconfig.model.d.ts.map +1 -1
  113. package/dist/applications/application-fieldconfig.model.js +3 -0
  114. package/dist/applications/application-legal.model.d.ts.map +1 -1
  115. package/dist/applications/application-legal.model.js +3 -0
  116. package/dist/applications/application-mortgage.model.d.ts +1 -0
  117. package/dist/applications/application-mortgage.model.d.ts.map +1 -1
  118. package/dist/applications/application-mortgage.model.js +3 -0
  119. package/dist/applications/application-mortgage.type.d.ts +76 -0
  120. package/dist/applications/application-mortgage.type.d.ts.map +1 -0
  121. package/dist/applications/application-mortgage.type.js +1 -0
  122. package/dist/applications/application-note.model.d.ts +36 -24
  123. package/dist/applications/application-note.model.d.ts.map +1 -1
  124. package/dist/applications/application-note.model.js +12 -3
  125. package/dist/applications/application-note.type.d.ts +55 -0
  126. package/dist/applications/application-note.type.d.ts.map +1 -0
  127. package/dist/applications/application-note.type.js +1 -0
  128. package/dist/applications/application-offer.model.d.ts.map +1 -1
  129. package/dist/applications/application-offer.model.js +3 -0
  130. package/dist/applications/application-onboarding.model.d.ts.map +1 -1
  131. package/dist/applications/application-onboarding.model.js +3 -0
  132. package/dist/applications/application-product.model.d.ts +77 -13
  133. package/dist/applications/application-product.model.d.ts.map +1 -1
  134. package/dist/applications/application-product.model.js +16 -3
  135. package/dist/applications/application-product.type.d.ts +58 -0
  136. package/dist/applications/application-product.type.d.ts.map +1 -0
  137. package/dist/applications/application-product.type.js +1 -0
  138. package/dist/applications/application-productfeatures.model.d.ts +12 -6
  139. package/dist/applications/application-productfeatures.model.d.ts.map +1 -1
  140. package/dist/applications/application-productfeatures.model.js +5 -1
  141. package/dist/applications/application-productfeatures.type.d.ts +125 -0
  142. package/dist/applications/application-productfeatures.type.d.ts.map +1 -0
  143. package/dist/applications/application-productfeatures.type.js +1 -0
  144. package/dist/applications/application-rationale.model.d.ts +6 -12
  145. package/dist/applications/application-rationale.model.d.ts.map +1 -1
  146. package/dist/applications/application-rationale.model.js +11 -20
  147. package/dist/applications/application-rationale.type.d.ts +7 -7
  148. package/dist/applications/application-rationale.type.d.ts.map +1 -1
  149. package/dist/applications/application-risk-narrative.model.d.ts.map +1 -1
  150. package/dist/applications/application-risk-narrative.model.js +3 -0
  151. package/dist/applications/application-valuation-report.model.d.ts +1246 -0
  152. package/dist/applications/application-valuation-report.model.d.ts.map +1 -0
  153. package/dist/applications/application-valuation-report.model.js +269 -0
  154. package/dist/applications/application-valuation-report.type.d.ts +108 -0
  155. package/dist/applications/application-valuation-report.type.d.ts.map +1 -0
  156. package/dist/applications/application-valuation-report.type.js +1 -0
  157. package/dist/applications/application-valuation.model.d.ts +695 -18
  158. package/dist/applications/application-valuation.model.d.ts.map +1 -1
  159. package/dist/applications/application-valuation.model.js +33 -7
  160. package/dist/applications/application-valuation.type.d.ts +54 -0
  161. package/dist/applications/application-valuation.type.d.ts.map +1 -0
  162. package/dist/applications/application-valuation.type.js +1 -0
  163. package/dist/applications/application.model.d.ts +36 -30
  164. package/dist/applications/application.model.d.ts.map +1 -1
  165. package/dist/applications/application.model.js +17 -4
  166. package/dist/applications/applications-task.model.d.ts +171 -67
  167. package/dist/applications/applications-task.model.d.ts.map +1 -1
  168. package/dist/applications/applications-task.model.js +36 -45
  169. package/dist/applications/applications-task.type.d.ts +57 -0
  170. package/dist/applications/applications-task.type.d.ts.map +1 -0
  171. package/dist/applications/applications-task.type.js +1 -0
  172. package/dist/applications/broker.model.d.ts.map +1 -1
  173. package/dist/applications/broker.model.js +3 -0
  174. package/dist/applications/index.d.ts +10 -3
  175. package/dist/applications/index.d.ts.map +1 -1
  176. package/dist/applications/index.js +2 -3
  177. package/dist/applications/solicitor.model.d.ts +2 -0
  178. package/dist/applications/solicitor.model.d.ts.map +1 -1
  179. package/dist/applications/solicitor.model.js +3 -0
  180. package/dist/index.d.ts +1 -0
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +2 -0
  183. package/dist/product-catalogues/index.d.ts +3 -0
  184. package/dist/product-catalogues/index.d.ts.map +1 -1
  185. package/dist/product-catalogues/product-catalogue.type.d.ts +15 -0
  186. package/dist/product-catalogues/product-catalogue.type.d.ts.map +1 -0
  187. package/dist/product-catalogues/product-catalogue.type.js +1 -0
  188. package/dist/product-catalogues/product-definitions.type.d.ts +53 -0
  189. package/dist/product-catalogues/product-definitions.type.d.ts.map +1 -0
  190. package/dist/product-catalogues/product-definitions.type.js +1 -0
  191. package/dist/product-catalogues/product-variant.type.d.ts +38 -0
  192. package/dist/product-catalogues/product-variant.type.d.ts.map +1 -0
  193. package/dist/product-catalogues/product-variant.type.js +1 -0
  194. package/dist/properties/property.model.d.ts +52 -51
  195. package/dist/properties/property.model.d.ts.map +1 -1
  196. package/dist/properties/property.model.js +1 -2
  197. package/dist/properties/security.model.d.ts +6 -0
  198. package/dist/properties/security.model.d.ts.map +1 -1
  199. package/dist/properties/security.model.js +1 -0
  200. package/dist/shared/alert.model.d.ts +12 -12
  201. package/dist/shared/api-log.model.d.ts +118 -0
  202. package/dist/shared/api-log.model.d.ts.map +1 -0
  203. package/dist/shared/api-log.model.js +21 -0
  204. package/dist/shared/apprivo-sync-journey.model.d.ts +6 -6
  205. package/dist/shared/checklist.model.d.ts +6 -6
  206. package/dist/shared/index.d.ts +5 -1
  207. package/dist/shared/index.d.ts.map +1 -1
  208. package/dist/shared/index.js +4 -1
  209. package/dist/shared/job-setting.model.d.ts +6 -6
  210. package/dist/shared/lookup-group.model.d.ts +25 -25
  211. package/dist/shared/lookup-group.model.d.ts.map +1 -1
  212. package/dist/shared/lookup-group.model.js +3 -0
  213. package/dist/shared/schema-doc.model.d.ts +6 -6
  214. package/dist/shared/system-parameter.model.d.ts +6 -6
  215. package/dist/shared/task-document.model.d.ts +6 -6
  216. package/dist/shared/task.model.d.ts +6 -6
  217. package/dist/shared/{document-type-model.d.ts → webhook-event.model.d.ts} +6 -45
  218. package/dist/shared/webhook-event.model.d.ts.map +1 -0
  219. package/dist/shared/webhook-event.model.js +53 -0
  220. package/dist/shared/webhook-event.type.d.ts +15 -0
  221. package/dist/shared/webhook-event.type.d.ts.map +1 -0
  222. package/dist/shared/webhook-event.type.js +1 -0
  223. package/dist/shared/workflow-trigger.model.d.ts +32 -0
  224. package/dist/shared/workflow-trigger.model.d.ts.map +1 -0
  225. package/dist/shared/workflow-trigger.model.js +45 -0
  226. package/dist/shared/workflow-trigger.type.d.ts +59 -0
  227. package/dist/shared/workflow-trigger.type.d.ts.map +1 -0
  228. package/dist/shared/workflow-trigger.type.js +1 -0
  229. package/dist/shared/workflow.init.d.ts +21 -0
  230. package/dist/shared/workflow.init.d.ts.map +1 -0
  231. package/dist/shared/workflow.init.js +41 -0
  232. package/dist/shared/workflow.middleware.d.ts +107 -0
  233. package/dist/shared/workflow.middleware.d.ts.map +1 -0
  234. package/dist/shared/workflow.middleware.js +230 -0
  235. package/dist/shared/workflow.plugin.d.ts +46 -0
  236. package/dist/shared/workflow.plugin.d.ts.map +1 -0
  237. package/dist/shared/workflow.plugin.js +102 -0
  238. package/dist/shared/workflow.service.d.ts +39 -0
  239. package/dist/shared/workflow.service.d.ts.map +1 -0
  240. package/dist/shared/workflow.service.js +115 -0
  241. package/dist/value-objects/pound.d.ts.map +1 -1
  242. package/package.json +14 -3
  243. package/dist/applicants/applicant-income.model.d.ts +0 -2558
  244. package/dist/applicants/applicant-income.model.js +0 -82
  245. package/dist/applications/application-document.model.d.ts +0 -186
  246. package/dist/applications/application-document.model.d.ts.map +0 -1
  247. package/dist/applications/application-document.model.js +0 -35
  248. package/dist/applications/document.model.d.ts +0 -186
  249. package/dist/applications/document.model.d.ts.map +0 -1
  250. package/dist/applications/document.model.js +0 -35
  251. package/dist/shared/document-type-model.d.ts.map +0 -1
  252. package/dist/shared/document-type-model.js +0 -10
package/README.md ADDED
@@ -0,0 +1,309 @@
1
+ # GB Schemas (@dynamatix/gb-schemas)
2
+
3
+ A comprehensive TypeScript/Mongoose schema library for Gatehouse Bank backend systems, providing data models for mortgage applications, applicants, properties, and related financial services.
4
+
5
+ ## 🏗️ Project Overview
6
+
7
+ This package contains all the schemas and data models used in Gatehouse Bank's backend systems. It provides a robust foundation for managing mortgage applications, applicant data, property information, and various financial commitments through well-defined Mongoose schemas with TypeScript support.
8
+
9
+ ## 📦 Package Information
10
+
11
+ - **Name**: `@dynamatix/gb-schemas`
12
+ - **Version**: 1.3.305
13
+ - **Description**: All the schemas for Gatehouse Bank back-end
14
+ - **Type**: ES Module
15
+ - **Main**: `dist/index.js`
16
+ - **Types**: `dist/index.d.ts`
17
+
18
+ ## 🚀 Features
19
+
20
+ - **TypeScript Support**: Full TypeScript definitions and type safety
21
+ - **Mongoose Integration**: Built on Mongoose ODM for MongoDB
22
+ - **Audit Middleware**: Built-in audit trail support via `@dynamatix/cat-shared`
23
+ - **Workflow Middleware**: Automatic workflow triggering based on database events
24
+ - **Custom Value Objects**: Specialized types for financial data (Pound, Account Number, Sort Code)
25
+ - **Modular Architecture**: Organized into logical domains (applications, applicants, properties, etc.)
26
+ - **Migration Scripts**: Comprehensive data migration and maintenance tools
27
+
28
+ ## 📁 Project Structure
29
+
30
+ ```
31
+ gb-schemas-node/
32
+ ├── applicants/ # Applicant-related schemas and models
33
+ ├── applications/ # Application management schemas
34
+ ├── properties/ # Property and security schemas
35
+ ├── product-catalogues/ # Product definition schemas
36
+ ├── shared/ # Common/shared schemas and utilities
37
+ ├── users/ # User management schemas
38
+ ├── underwriter/ # Underwriting-related schemas
39
+ ├── value-objects/ # Custom Mongoose types
40
+ ├── api-models/ # API-specific model definitions
41
+ ├── entities/ # Entity layer schemas
42
+ ├── examples/ # Usage examples
43
+ ├── scripts/ # Migration and utility scripts
44
+ └── schema-docs/ # Schema documentation generation
45
+ ```
46
+
47
+ ## 🔧 Installation
48
+
49
+ ```bash
50
+ npm install @dynamatix/gb-schemas
51
+ ```
52
+
53
+ ## 📚 Usage
54
+
55
+ ### Basic Import
56
+
57
+ ```typescript
58
+ import {
59
+ ApplicantModel,
60
+ ApplicationModel,
61
+ PropertyModel
62
+ } from '@dynamatix/gb-schemas';
63
+ ```
64
+
65
+ ### Modular Imports
66
+
67
+ ```typescript
68
+ // Import specific modules
69
+ import { ApplicantModel } from '@dynamatix/gb-schemas/applicants';
70
+ import { ApplicationModel } from '@dynamatix/gb-schemas/applications';
71
+ import { PropertyModel } from '@dynamatix/gb-schemas/properties';
72
+ ```
73
+
74
+ ### Example: Adding Applicant Income
75
+
76
+ ```typescript
77
+ import mongoose from 'mongoose';
78
+ import ApplicantIncomeModel from '@dynamatix/gb-schemas/applicants/applicant-income.model';
79
+
80
+ // Connect to MongoDB
81
+ await mongoose.connect(MONGODB_URI);
82
+
83
+ // Create new applicant income record
84
+ const newIncome = new ApplicantIncomeModel({
85
+ applicantId: 'your-applicant-id',
86
+ selfEmployedIncomeRationale: 'Based on last 2 years of accounts'
87
+ });
88
+
89
+ const savedIncome = await newIncome.save();
90
+ ```
91
+
92
+ ### Workflow Middleware
93
+
94
+ The library includes a powerful workflow middleware system that automatically triggers workflows based on database events.
95
+
96
+ ```typescript
97
+ import { initializeWorkflowMiddlewareWithCheck } from '@dynamatix/gb-schemas';
98
+
99
+ // Initialize workflow middleware for ALL schemas with one call
100
+ initializeWorkflowMiddlewareWithCheck();
101
+ ```
102
+
103
+ **Environment Variables:**
104
+ - `WORKFLOW_API_KEY`: Required API key for workflow service authentication
105
+ - `WORKFLOW_API_URL`: Optional workflow API URL (default: https://your-workflow-api.com/api/v1/workflows/execute)
106
+ - `WORKFLOW_TIMEOUT`: Optional timeout in milliseconds (default: 30000)
107
+ - `WORKFLOW_RETRY_ATTEMPTS`: Optional retry attempts (default: 3)
108
+ - `WORKFLOW_RETRY_DELAY`: Optional retry delay in milliseconds (default: 1000)
109
+
110
+ For detailed documentation, see [Workflow Middleware Guide](./docs/WORKFLOW_MIDDLEWARE.md).
111
+
112
+ ## 🏛️ Core Schemas
113
+
114
+ ### Applicants
115
+ - **Applicant**: Core applicant information (personal details, addresses, employment status)
116
+ - **Applicant Income**: Various income types (employment, self-employed, pension, property)
117
+ - **Applicant Commitments**: Financial commitments (mortgages, loans, credit cards)
118
+ - **Applicant Credit Data**: Credit profile and credit report information
119
+ - **Applicant Expenditure**: Spending patterns and financial outgoings
120
+
121
+ ### Applications
122
+ - **Application**: Main application record with workflow and status tracking
123
+ - **Application Mortgage**: Mortgage-specific application details
124
+ - **Application Credit Profile**: Credit assessment information
125
+ - **Application Legal**: Legal documentation and compliance data
126
+ - **Application Notes**: Application-related notes and comments
127
+
128
+ ### Properties
129
+ - **Property**: Property details and characteristics
130
+ - **Security**: Security and collateral information
131
+
132
+ ### Product Catalogues
133
+ - **Product Catalogue**: Product definitions and variants
134
+ - **Product Definitions**: Detailed product specifications
135
+ - **Product Variants**: Product customization options
136
+
137
+ ### Shared Models
138
+ - **Lookup**: Reference data and lookup values
139
+ - **System Parameters**: Configuration and system settings
140
+ - **Tasks**: Workflow task management
141
+ - **Alerts**: System notification system
142
+ - **Workflow Triggers**: Configuration for automatic workflow execution
143
+
144
+ ## 💰 Custom Value Objects
145
+
146
+ ### Pound Type
147
+ Custom Mongoose type for handling UK currency values with automatic formatting and validation.
148
+
149
+ ```typescript
150
+ import { Pound, formatPound } from '@dynamatix/gb-schemas/value-objects/pound';
151
+
152
+ // Automatically handles currency formatting and validation
153
+ const amount = new Pound('1,234.56'); // Returns 1234.56
154
+ const formatted = formatPound(1234.56); // Returns "£1,234.56"
155
+ ```
156
+
157
+ ### Account Number & Sort Code
158
+ Specialized types for UK banking information with validation.
159
+
160
+ ## 🔄 Migration Scripts
161
+
162
+ The project includes comprehensive migration and maintenance scripts:
163
+
164
+ ### Available Scripts
165
+
166
+ ```bash
167
+ # Income migration
168
+ npm run migrate:applicant-income
169
+
170
+ # Self-employed ID migration
171
+ npm run migrate:self-employed-id
172
+
173
+ # Employment verification
174
+ npm run check:applicants-employment
175
+
176
+ # Application cleanup
177
+ npm run delete:applications-by-type
178
+
179
+ # API config updates
180
+ npm run update:apiconfigs-paths
181
+ ```
182
+
183
+ ### Key Migration Scripts
184
+
185
+ - **`migrate-applicant-income.js`**: Migrates from old income model to new separated models
186
+ - **`migrate-self-employed-id.js`**: Updates self-employed applicant references
187
+ - **`check-applicants-without-employment.js`**: Validates employment data integrity
188
+ - **`update-apiconfigs-paths.js`**: Updates API configuration paths
189
+
190
+ ## 🛠️ Development
191
+
192
+ ### Prerequisites
193
+
194
+ - Node.js (v18+)
195
+ - TypeScript 5.3+
196
+ - MongoDB 6.14+
197
+
198
+ ### Setup
199
+
200
+ ```bash
201
+ # Install dependencies
202
+ npm install
203
+
204
+ # Build the project
205
+ npm run build
206
+
207
+ # Generate documentation
208
+ npm run generate-docs
209
+
210
+ # Run examples
211
+ npm run example:income
212
+ ```
213
+
214
+ ### Build Configuration
215
+
216
+ The project uses TypeScript with ES2020 modules and generates declaration files:
217
+
218
+ ```json
219
+ {
220
+ "target": "ES2020",
221
+ "module": "ES2020",
222
+ "outDir": "./dist",
223
+ "declaration": true,
224
+ "declarationMap": true
225
+ }
226
+ ```
227
+
228
+ ## 📖 API Reference
229
+
230
+ ### Main Exports
231
+
232
+ ```typescript
233
+ // Core models
234
+ export * from './applications';
235
+ export * from './applicants';
236
+ export * from './properties';
237
+ export * from './shared';
238
+ export * from './users';
239
+ export * from './product-catalogues';
240
+ export * from './underwriter';
241
+ ```
242
+
243
+ ### Model Relationships
244
+
245
+ - **Applications** → **Applicants** (one-to-many)
246
+ - **Applications** → **Properties** (one-to-many)
247
+ - **Applications** → **Product** (many-to-one)
248
+ - **Applicants** → **Income Models** (one-to-many)
249
+ - **Applicants** → **Commitment Models** (one-to-many)
250
+
251
+ ## 🔒 Security & Compliance
252
+
253
+ - **GDPR Support**: Built-in GDPR consent tracking
254
+ - **Audit Trail**: Comprehensive audit logging via middleware
255
+ - **Data Validation**: Strict schema validation and type checking
256
+ - **Access Control**: User permission and role-based access models
257
+
258
+ ## 🧪 Testing & Examples
259
+
260
+ ### Example Scripts
261
+
262
+ - **`add-applicant-income.ts`**: Demonstrates creating applicant income records
263
+ - **Migration Scripts**: Show real-world data migration patterns
264
+
265
+ ### Running Examples
266
+
267
+ ```bash
268
+ # Run income example
269
+ npm run example:income
270
+
271
+ # Generate documentation
272
+ npm run generate-docs
273
+ ```
274
+
275
+ ## 📝 Documentation
276
+
277
+ - **Schema Documentation**: Auto-generated via `npm run generate-docs`
278
+ - **Migration Guides**: Detailed README files in the `scripts/` directory
279
+ - **API Models**: Type-safe API model definitions
280
+
281
+ ## 🤝 Contributing
282
+
283
+ 1. Fork the repository
284
+ 2. Create a feature branch
285
+ 3. Make your changes
286
+ 4. Ensure TypeScript compilation passes
287
+ 5. Submit a pull request
288
+
289
+ ## 📄 License
290
+
291
+ ISC License - see package.json for details
292
+
293
+ ## 🆘 Support
294
+
295
+ - **Issues**: [GitHub Issues](https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas/issues)
296
+ - **Repository**: [GitHub Repository](https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas)
297
+ - **Author**: Dynamatix
298
+
299
+ ## 🔄 Version History
300
+
301
+ - **Current**: 1.3.305
302
+ - **Dependencies**:
303
+ - `@dynamatix/cat-shared`: ^0.0.119
304
+ - `mongoose`: ^8.9.5
305
+ - `mongodb`: ^6.14.2
306
+
307
+ ---
308
+
309
+ *This package provides the foundational data layer for Gatehouse Bank's mortgage and financial services backend systems.*
@@ -1,3 +1,4 @@
1
+ /// <reference path="../value-objects/pound.d.ts" />
1
2
  /// <reference path="../value-objects/account-number.d.ts" />
2
3
  /// <reference path="../value-objects/sort-code.d.ts" />
3
4
  /// <reference types="mongoose/types/aggregate" />
@@ -52,14 +53,14 @@ declare const ApplicantAdditionalIncomeModel: mongoose.Model<{
52
53
  } | null | undefined;
53
54
  set?: {} | null | undefined;
54
55
  validate?: {} | null | undefined;
56
+ index?: {} | null | undefined;
55
57
  default?: {} | null | undefined;
56
58
  text?: {} | null | undefined;
57
59
  unique?: {} | null | undefined;
58
- index?: {} | null | undefined;
59
60
  sparse?: {} | null | undefined;
61
+ cast?: {} | null | undefined;
60
62
  required?: {} | null | undefined;
61
63
  ref?: {} | null | undefined;
62
- cast?: {} | null | undefined;
63
64
  select?: {} | null | undefined;
64
65
  immutable?: {} | null | undefined;
65
66
  transform?: {} | null | undefined;
@@ -102,14 +103,14 @@ declare const ApplicantAdditionalIncomeModel: mongoose.Model<{
102
103
  } | null | undefined;
103
104
  set?: {} | null | undefined;
104
105
  validate?: {} | null | undefined;
106
+ index?: {} | null | undefined;
105
107
  default?: {} | null | undefined;
106
108
  text?: {} | null | undefined;
107
109
  unique?: {} | null | undefined;
108
- index?: {} | null | undefined;
109
110
  sparse?: {} | null | undefined;
111
+ cast?: {} | null | undefined;
110
112
  required?: {} | null | undefined;
111
113
  ref?: {} | null | undefined;
112
- cast?: {} | null | undefined;
113
114
  select?: {} | null | undefined;
114
115
  immutable?: {} | null | undefined;
115
116
  transform?: {} | null | undefined;
@@ -154,14 +155,14 @@ declare const ApplicantAdditionalIncomeModel: mongoose.Model<{
154
155
  } | null | undefined;
155
156
  set?: {} | null | undefined;
156
157
  validate?: {} | null | undefined;
158
+ index?: {} | null | undefined;
157
159
  default?: {} | null | undefined;
158
160
  text?: {} | null | undefined;
159
161
  unique?: {} | null | undefined;
160
- index?: {} | null | undefined;
161
162
  sparse?: {} | null | undefined;
163
+ cast?: {} | null | undefined;
162
164
  required?: {} | null | undefined;
163
165
  ref?: {} | null | undefined;
164
- cast?: {} | null | undefined;
165
166
  select?: {} | null | undefined;
166
167
  immutable?: {} | null | undefined;
167
168
  transform?: {} | null | undefined;
@@ -204,14 +205,14 @@ declare const ApplicantAdditionalIncomeModel: mongoose.Model<{
204
205
  } | null | undefined;
205
206
  set?: {} | null | undefined;
206
207
  validate?: {} | null | undefined;
208
+ index?: {} | null | undefined;
207
209
  default?: {} | null | undefined;
208
210
  text?: {} | null | undefined;
209
211
  unique?: {} | null | undefined;
210
- index?: {} | null | undefined;
211
212
  sparse?: {} | null | undefined;
213
+ cast?: {} | null | undefined;
212
214
  required?: {} | null | undefined;
213
215
  ref?: {} | null | undefined;
214
- cast?: {} | null | undefined;
215
216
  select?: {} | null | undefined;
216
217
  immutable?: {} | null | undefined;
217
218
  transform?: {} | null | undefined;
@@ -256,14 +257,14 @@ declare const ApplicantAdditionalIncomeModel: mongoose.Model<{
256
257
  } | null | undefined;
257
258
  set?: {} | null | undefined;
258
259
  validate?: {} | null | undefined;
260
+ index?: {} | null | undefined;
259
261
  default?: {} | null | undefined;
260
262
  text?: {} | null | undefined;
261
263
  unique?: {} | null | undefined;
262
- index?: {} | null | undefined;
263
264
  sparse?: {} | null | undefined;
265
+ cast?: {} | null | undefined;
264
266
  required?: {} | null | undefined;
265
267
  ref?: {} | null | undefined;
266
- cast?: {} | null | undefined;
267
268
  select?: {} | null | undefined;
268
269
  immutable?: {} | null | undefined;
269
270
  transform?: {} | null | undefined;
@@ -306,14 +307,14 @@ declare const ApplicantAdditionalIncomeModel: mongoose.Model<{
306
307
  } | null | undefined;
307
308
  set?: {} | null | undefined;
308
309
  validate?: {} | null | undefined;
310
+ index?: {} | null | undefined;
309
311
  default?: {} | null | undefined;
310
312
  text?: {} | null | undefined;
311
313
  unique?: {} | null | undefined;
312
- index?: {} | null | undefined;
313
314
  sparse?: {} | null | undefined;
315
+ cast?: {} | null | undefined;
314
316
  required?: {} | null | undefined;
315
317
  ref?: {} | null | undefined;
316
- cast?: {} | null | undefined;
317
318
  select?: {} | null | undefined;
318
319
  immutable?: {} | null | undefined;
319
320
  transform?: {} | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-additional-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-additional-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA2B5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiF,CAAC;AAEtH,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"applicant-additional-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-additional-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgC5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiF,CAAC;AAEtH,eAAe,8BAA8B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import mongoose from "mongoose";
2
+ import { applyWorkflowPlugin } from "../shared/workflow.plugin";
2
3
  import { Pound, formatPound } from "../value-objects/pound";
3
4
  import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
4
5
  const applicantAdditionalIncomeSchema = new mongoose.Schema({
@@ -25,5 +26,7 @@ const applicantAdditionalIncomeSchema = new mongoose.Schema({
25
26
  toObject: { getters: true }
26
27
  });
27
28
  applyAuditMiddleware(applicantAdditionalIncomeSchema, "Applicant_Additional_Income");
29
+ // Apply workflow plugin to the schema
30
+ applyWorkflowPlugin(applicantAdditionalIncomeSchema, 'applicant_additional_income');
28
31
  const ApplicantAdditionalIncomeModel = mongoose.model("Applicant_Additional_Income", applicantAdditionalIncomeSchema);
29
32
  export default ApplicantAdditionalIncomeModel;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../value-objects/pound.d.ts" />
1
2
  /// <reference path="../value-objects/account-number.d.ts" />
2
3
  /// <reference path="../value-objects/sort-code.d.ts" />
3
4
  /// <reference types="mongoose/types/aggregate" />
@@ -54,14 +55,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
54
55
  } | null | undefined;
55
56
  set?: {} | null | undefined;
56
57
  validate?: {} | null | undefined;
58
+ index?: {} | null | undefined;
57
59
  default?: {} | null | undefined;
58
60
  text?: {} | null | undefined;
59
61
  unique?: {} | null | undefined;
60
- index?: {} | null | undefined;
61
62
  sparse?: {} | null | undefined;
63
+ cast?: {} | null | undefined;
62
64
  required?: {} | null | undefined;
63
65
  ref?: {} | null | undefined;
64
- cast?: {} | null | undefined;
65
66
  select?: {} | null | undefined;
66
67
  immutable?: {} | null | undefined;
67
68
  transform?: {} | null | undefined;
@@ -105,14 +106,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
105
106
  } | null | undefined;
106
107
  set?: {} | null | undefined;
107
108
  validate?: {} | null | undefined;
109
+ index?: {} | null | undefined;
108
110
  default?: {} | null | undefined;
109
111
  text?: {} | null | undefined;
110
112
  unique?: {} | null | undefined;
111
- index?: {} | null | undefined;
112
113
  sparse?: {} | null | undefined;
114
+ cast?: {} | null | undefined;
113
115
  required?: {} | null | undefined;
114
116
  ref?: {} | null | undefined;
115
- cast?: {} | null | undefined;
116
117
  select?: {} | null | undefined;
117
118
  immutable?: {} | null | undefined;
118
119
  transform?: {} | null | undefined;
@@ -154,14 +155,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
154
155
  } | null | undefined;
155
156
  set?: {} | null | undefined;
156
157
  validate?: {} | null | undefined;
158
+ index?: {} | null | undefined;
157
159
  default?: {} | null | undefined;
158
160
  text?: {} | null | undefined;
159
161
  unique?: {} | null | undefined;
160
- index?: {} | null | undefined;
161
162
  sparse?: {} | null | undefined;
163
+ cast?: {} | null | undefined;
162
164
  required?: {} | null | undefined;
163
165
  ref?: {} | null | undefined;
164
- cast?: {} | null | undefined;
165
166
  select?: {} | null | undefined;
166
167
  immutable?: {} | null | undefined;
167
168
  transform?: {} | null | undefined;
@@ -207,14 +208,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
207
208
  } | null | undefined;
208
209
  set?: {} | null | undefined;
209
210
  validate?: {} | null | undefined;
211
+ index?: {} | null | undefined;
210
212
  default?: {} | null | undefined;
211
213
  text?: {} | null | undefined;
212
214
  unique?: {} | null | undefined;
213
- index?: {} | null | undefined;
214
215
  sparse?: {} | null | undefined;
216
+ cast?: {} | null | undefined;
215
217
  required?: {} | null | undefined;
216
218
  ref?: {} | null | undefined;
217
- cast?: {} | null | undefined;
218
219
  select?: {} | null | undefined;
219
220
  immutable?: {} | null | undefined;
220
221
  transform?: {} | null | undefined;
@@ -258,14 +259,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
258
259
  } | null | undefined;
259
260
  set?: {} | null | undefined;
260
261
  validate?: {} | null | undefined;
262
+ index?: {} | null | undefined;
261
263
  default?: {} | null | undefined;
262
264
  text?: {} | null | undefined;
263
265
  unique?: {} | null | undefined;
264
- index?: {} | null | undefined;
265
266
  sparse?: {} | null | undefined;
267
+ cast?: {} | null | undefined;
266
268
  required?: {} | null | undefined;
267
269
  ref?: {} | null | undefined;
268
- cast?: {} | null | undefined;
269
270
  select?: {} | null | undefined;
270
271
  immutable?: {} | null | undefined;
271
272
  transform?: {} | null | undefined;
@@ -307,14 +308,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
307
308
  } | null | undefined;
308
309
  set?: {} | null | undefined;
309
310
  validate?: {} | null | undefined;
311
+ index?: {} | null | undefined;
310
312
  default?: {} | null | undefined;
311
313
  text?: {} | null | undefined;
312
314
  unique?: {} | null | undefined;
313
- index?: {} | null | undefined;
314
315
  sparse?: {} | null | undefined;
316
+ cast?: {} | null | undefined;
315
317
  required?: {} | null | undefined;
316
318
  ref?: {} | null | undefined;
317
- cast?: {} | null | undefined;
318
319
  select?: {} | null | undefined;
319
320
  immutable?: {} | null | undefined;
320
321
  transform?: {} | null | undefined;
@@ -360,14 +361,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
360
361
  } | null | undefined;
361
362
  set?: {} | null | undefined;
362
363
  validate?: {} | null | undefined;
364
+ index?: {} | null | undefined;
363
365
  default?: {} | null | undefined;
364
366
  text?: {} | null | undefined;
365
367
  unique?: {} | null | undefined;
366
- index?: {} | null | undefined;
367
368
  sparse?: {} | null | undefined;
369
+ cast?: {} | null | undefined;
368
370
  required?: {} | null | undefined;
369
371
  ref?: {} | null | undefined;
370
- cast?: {} | null | undefined;
371
372
  select?: {} | null | undefined;
372
373
  immutable?: {} | null | undefined;
373
374
  transform?: {} | null | undefined;
@@ -411,14 +412,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
411
412
  } | null | undefined;
412
413
  set?: {} | null | undefined;
413
414
  validate?: {} | null | undefined;
415
+ index?: {} | null | undefined;
414
416
  default?: {} | null | undefined;
415
417
  text?: {} | null | undefined;
416
418
  unique?: {} | null | undefined;
417
- index?: {} | null | undefined;
418
419
  sparse?: {} | null | undefined;
420
+ cast?: {} | null | undefined;
419
421
  required?: {} | null | undefined;
420
422
  ref?: {} | null | undefined;
421
- cast?: {} | null | undefined;
422
423
  select?: {} | null | undefined;
423
424
  immutable?: {} | null | undefined;
424
425
  transform?: {} | null | undefined;
@@ -460,14 +461,14 @@ declare const CreditCardCommitmentModel: mongoose.Model<{
460
461
  } | null | undefined;
461
462
  set?: {} | null | undefined;
462
463
  validate?: {} | null | undefined;
464
+ index?: {} | null | undefined;
463
465
  default?: {} | null | undefined;
464
466
  text?: {} | null | undefined;
465
467
  unique?: {} | null | undefined;
466
- index?: {} | null | undefined;
467
468
  sparse?: {} | null | undefined;
469
+ cast?: {} | null | undefined;
468
470
  required?: {} | null | undefined;
469
471
  ref?: {} | null | undefined;
470
- cast?: {} | null | undefined;
471
472
  select?: {} | null | undefined;
472
473
  immutable?: {} | null | undefined;
473
474
  transform?: {} | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-creditCard.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-creditCard.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAkC/C,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqE,CAAC;AACrG,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"applicant-commitment-creditCard.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-creditCard.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAuC/C,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqE,CAAC;AACrG,eAAe,yBAAyB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import mongoose from "mongoose";
2
+ import { applyWorkflowPlugin } from "../shared/workflow.plugin";
2
3
  import { Pound } from "../value-objects/pound";
3
4
  import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
4
5
  const creditCardCommitmentSchema = new mongoose.Schema({
@@ -30,5 +31,7 @@ creditCardCommitmentSchema.virtual('ApplicationId', {
30
31
  options: { select: 'applicationId' }
31
32
  });
32
33
  applyAuditMiddleware(creditCardCommitmentSchema, "CreditCardCommitment");
34
+ // Apply workflow plugin to the schema
35
+ applyWorkflowPlugin(creditCardCommitmentSchema, 'creditcardcommitment');
33
36
  const CreditCardCommitmentModel = mongoose.model("CreditCardCommitment", creditCardCommitmentSchema);
34
37
  export default CreditCardCommitmentModel;