@dynamatix/gb-schemas 1.3.360 → 1.3.362-broker

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/README.md CHANGED
@@ -1,309 +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
-
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
309
  *This package provides the foundational data layer for Gatehouse Bank's mortgage and financial services backend systems.*
@@ -226,7 +226,7 @@ declare const ApplicantModel: mongoose.Model<{
226
226
  relationshipToOthers?: unknown;
227
227
  residentialStatusLid?: mongoose.Types.ObjectId | null | undefined;
228
228
  retirementAge?: unknown;
229
- taxPayerLid?: mongoose.Types.ObjectId | null | undefined;
229
+ taxPayerLid?: unknown;
230
230
  timeResidedAtCountryOfResidence?: unknown;
231
231
  title?: unknown;
232
232
  isTwoYearPrior?: unknown;
@@ -708,7 +708,7 @@ declare const ApplicantModel: mongoose.Model<{
708
708
  relationshipToOthers?: unknown;
709
709
  residentialStatusLid?: mongoose.Types.ObjectId | null | undefined;
710
710
  retirementAge?: unknown;
711
- taxPayerLid?: mongoose.Types.ObjectId | null | undefined;
711
+ taxPayerLid?: unknown;
712
712
  timeResidedAtCountryOfResidence?: unknown;
713
713
  title?: unknown;
714
714
  isTwoYearPrior?: unknown;
@@ -1190,7 +1190,7 @@ declare const ApplicantModel: mongoose.Model<{
1190
1190
  relationshipToOthers?: unknown;
1191
1191
  residentialStatusLid?: mongoose.Types.ObjectId | null | undefined;
1192
1192
  retirementAge?: unknown;
1193
- taxPayerLid?: mongoose.Types.ObjectId | null | undefined;
1193
+ taxPayerLid?: unknown;
1194
1194
  timeResidedAtCountryOfResidence?: unknown;
1195
1195
  title?: unknown;
1196
1196
  isTwoYearPrior?: unknown;
@@ -1505,7 +1505,6 @@ declare const ApplicantModel: mongoose.Model<{
1505
1505
  ccjInLastThreeYearNo: string;
1506
1506
  defaultsInLastYearNo: string;
1507
1507
  };
1508
- lastName: string;
1509
1508
  incomeSourceId: mongoose.Types.ObjectId;
1510
1509
  addressMovedDate: string;
1511
1510
  correspondenceAddressCity: string;
@@ -1531,7 +1530,6 @@ declare const ApplicantModel: mongoose.Model<{
1531
1530
  gdprPost: boolean;
1532
1531
  gdprTelephone: boolean;
1533
1532
  gdprTextMessage: boolean;
1534
- gender: string;
1535
1533
  hasBrokerGivenConsentForVulnerabilities: boolean;
1536
1534
  hasLinkedJurisdiction: boolean;
1537
1535
  isCorrespondence: boolean;
@@ -1575,7 +1573,6 @@ declare const ApplicantModel: mongoose.Model<{
1575
1573
  previous2AddressPostCode: string;
1576
1574
  previous2AddressPropertyOwnedBy: string;
1577
1575
  residentialStatusLid: mongoose.Types.ObjectId;
1578
- taxPayerLid: mongoose.Types.ObjectId;
1579
1576
  isTwoYearPrior: boolean;
1580
1577
  vulnerabilityNotes: string;
1581
1578
  vulnerabilityTypeLids: mongoose.Types.ObjectId[];
@@ -1630,16 +1627,19 @@ declare const ApplicantModel: mongoose.Model<{
1630
1627
  isUkResident?: boolean | null | undefined;
1631
1628
  email?: string | null | undefined;
1632
1629
  firstName?: string | null | undefined;
1630
+ lastName?: string | null | undefined;
1633
1631
  isExpenseOwner?: boolean | null | undefined;
1634
1632
  serialName?: string | null | undefined;
1635
1633
  countryOfResidenceLid?: mongoose.Types.ObjectId | null | undefined;
1636
1634
  positionLid?: mongoose.Types.ObjectId | null | undefined;
1637
1635
  dateOfBirth?: string | null | undefined;
1636
+ gender?: string | null | undefined;
1638
1637
  maritalStatusLid?: mongoose.Types.ObjectId | null | undefined;
1639
1638
  nationalityLid?: mongoose.Types.ObjectId | null | undefined;
1640
1639
  niNumber?: string | null | undefined;
1641
1640
  relationshipToOthers?: string | null | undefined;
1642
1641
  retirementAge?: string | null | undefined;
1642
+ taxPayerLid?: mongoose.Types.ObjectId | null | undefined;
1643
1643
  timeResidedAtCountryOfResidence?: number | null | undefined;
1644
1644
  title?: string | null | undefined;
1645
1645
  understandEnglish?: boolean | null | undefined;
@@ -1661,7 +1661,6 @@ declare const ApplicantModel: mongoose.Model<{
1661
1661
  ccjInLastThreeYearNo: string;
1662
1662
  defaultsInLastYearNo: string;
1663
1663
  };
1664
- lastName: string;
1665
1664
  incomeSourceId: mongoose.Types.ObjectId;
1666
1665
  addressMovedDate: string;
1667
1666
  correspondenceAddressCity: string;
@@ -1687,7 +1686,6 @@ declare const ApplicantModel: mongoose.Model<{
1687
1686
  gdprPost: boolean;
1688
1687
  gdprTelephone: boolean;
1689
1688
  gdprTextMessage: boolean;
1690
- gender: string;
1691
1689
  hasBrokerGivenConsentForVulnerabilities: boolean;
1692
1690
  hasLinkedJurisdiction: boolean;
1693
1691
  isCorrespondence: boolean;
@@ -1731,7 +1729,6 @@ declare const ApplicantModel: mongoose.Model<{
1731
1729
  previous2AddressPostCode: string;
1732
1730
  previous2AddressPropertyOwnedBy: string;
1733
1731
  residentialStatusLid: mongoose.Types.ObjectId;
1734
- taxPayerLid: mongoose.Types.ObjectId;
1735
1732
  isTwoYearPrior: boolean;
1736
1733
  vulnerabilityNotes: string;
1737
1734
  vulnerabilityTypeLids: mongoose.Types.ObjectId[];
@@ -1786,16 +1783,19 @@ declare const ApplicantModel: mongoose.Model<{
1786
1783
  isUkResident?: boolean | null | undefined;
1787
1784
  email?: string | null | undefined;
1788
1785
  firstName?: string | null | undefined;
1786
+ lastName?: string | null | undefined;
1789
1787
  isExpenseOwner?: boolean | null | undefined;
1790
1788
  serialName?: string | null | undefined;
1791
1789
  countryOfResidenceLid?: mongoose.Types.ObjectId | null | undefined;
1792
1790
  positionLid?: mongoose.Types.ObjectId | null | undefined;
1793
1791
  dateOfBirth?: string | null | undefined;
1792
+ gender?: string | null | undefined;
1794
1793
  maritalStatusLid?: mongoose.Types.ObjectId | null | undefined;
1795
1794
  nationalityLid?: mongoose.Types.ObjectId | null | undefined;
1796
1795
  niNumber?: string | null | undefined;
1797
1796
  relationshipToOthers?: string | null | undefined;
1798
1797
  retirementAge?: string | null | undefined;
1798
+ taxPayerLid?: mongoose.Types.ObjectId | null | undefined;
1799
1799
  timeResidedAtCountryOfResidence?: number | null | undefined;
1800
1800
  title?: string | null | undefined;
1801
1801
  understandEnglish?: boolean | null | undefined;
@@ -1817,7 +1817,6 @@ declare const ApplicantModel: mongoose.Model<{
1817
1817
  ccjInLastThreeYearNo: string;
1818
1818
  defaultsInLastYearNo: string;
1819
1819
  };
1820
- lastName: string;
1821
1820
  incomeSourceId: mongoose.Types.ObjectId;
1822
1821
  addressMovedDate: string;
1823
1822
  correspondenceAddressCity: string;
@@ -1843,7 +1842,6 @@ declare const ApplicantModel: mongoose.Model<{
1843
1842
  gdprPost: boolean;
1844
1843
  gdprTelephone: boolean;
1845
1844
  gdprTextMessage: boolean;
1846
- gender: string;
1847
1845
  hasBrokerGivenConsentForVulnerabilities: boolean;
1848
1846
  hasLinkedJurisdiction: boolean;
1849
1847
  isCorrespondence: boolean;
@@ -1887,7 +1885,6 @@ declare const ApplicantModel: mongoose.Model<{
1887
1885
  previous2AddressPostCode: string;
1888
1886
  previous2AddressPropertyOwnedBy: string;
1889
1887
  residentialStatusLid: mongoose.Types.ObjectId;
1890
- taxPayerLid: mongoose.Types.ObjectId;
1891
1888
  isTwoYearPrior: boolean;
1892
1889
  vulnerabilityNotes: string;
1893
1890
  vulnerabilityTypeLids: mongoose.Types.ObjectId[];
@@ -1942,16 +1939,19 @@ declare const ApplicantModel: mongoose.Model<{
1942
1939
  isUkResident?: boolean | null | undefined;
1943
1940
  email?: string | null | undefined;
1944
1941
  firstName?: string | null | undefined;
1942
+ lastName?: string | null | undefined;
1945
1943
  isExpenseOwner?: boolean | null | undefined;
1946
1944
  serialName?: string | null | undefined;
1947
1945
  countryOfResidenceLid?: mongoose.Types.ObjectId | null | undefined;
1948
1946
  positionLid?: mongoose.Types.ObjectId | null | undefined;
1949
1947
  dateOfBirth?: string | null | undefined;
1948
+ gender?: string | null | undefined;
1950
1949
  maritalStatusLid?: mongoose.Types.ObjectId | null | undefined;
1951
1950
  nationalityLid?: mongoose.Types.ObjectId | null | undefined;
1952
1951
  niNumber?: string | null | undefined;
1953
1952
  relationshipToOthers?: string | null | undefined;
1954
1953
  retirementAge?: string | null | undefined;
1954
+ taxPayerLid?: mongoose.Types.ObjectId | null | undefined;
1955
1955
  timeResidedAtCountryOfResidence?: number | null | undefined;
1956
1956
  title?: string | null | undefined;
1957
1957
  understandEnglish?: boolean | null | undefined;
@@ -60,7 +60,7 @@ const applicantSchema = new mongoose.Schema({
60
60
  type: Boolean,
61
61
  default: false,
62
62
  },
63
- gender: { type: String, required: true },
63
+ gender: { type: String, required: false },
64
64
  hasBrokerGivenConsentForVulnerabilities: {
65
65
  type: Boolean,
66
66
  default: false,
@@ -106,7 +106,7 @@ const applicantSchema = new mongoose.Schema({
106
106
  classLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
107
107
  isExpenseOwner: Boolean,
108
108
  pageValidFlag: { type: Boolean, default: false },
109
- lastName: { type: String, required: true },
109
+ lastName: { type: String, required: false },
110
110
  linkedJurisdictionCountryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
111
111
  linkedJurisdictionDetails: { type: String, default: null },
112
112
  maidenName: { type: String, default: null },
@@ -141,7 +141,7 @@ const applicantSchema = new mongoose.Schema({
141
141
  residentialStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
142
142
  retirementAge: { type: String, required: false },
143
143
  taxJurisdictionLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: false },
144
- taxPayerLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
144
+ taxPayerLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: false },
145
145
  timeResidedAtCountryOfResidence: { type: Number, required: false },
146
146
  title: { type: String, required: false },
147
147
  isTwoYearPrior: {
@@ -9,7 +9,7 @@ const ApplicantShareholdingSchema = new mongoose.Schema({
9
9
  }, { _id: false });
10
10
  const companySchema = new mongoose.Schema({
11
11
  applicationId: {
12
- type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
12
+ type: mongoose.Schema.Types.ObjectId, ref: "Application", required: false,
13
13
  description: "Unique identifier for the application"
14
14
  },
15
15
  pageValidFlag: { type: Boolean, default: true, },
@@ -5,7 +5,7 @@ import mongoose from "mongoose";
5
5
  const additionalDataSchema = new mongoose.Schema({
6
6
  requesterId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: false },
7
7
  responderId: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: false },
8
- statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Status", required: false },
8
+ statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: false },
9
9
  concernTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "ConcernType", required: false },
10
10
  concernComments: { type: String, required: false },
11
11
  resolvedComments: { type: String, default: "" },
package/package.json CHANGED
@@ -1,87 +1,87 @@
1
- {
2
- "name": "@dynamatix/gb-schemas",
3
- "version": "1.3.360",
4
- "description": "All the schemas for gatehouse bank back-end",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "type": "module",
8
- "scripts": {
9
- "build": "tsc",
10
- "test": "echo \"Error: no test specified\" && exit 1",
11
- "test:workflow": "npm run build && node test-workflow.js",
12
- "test:workflow:env": "npm run build && WORKFLOW_API_KEY=test-key WORKFLOW_API_URL=http://localhost:3000/api/workflows node test-workflow-with-env.js",
13
- "example:app": "npm run build && node example-app-usage.js",
14
- "test:workflow:triggers": "npm run build && node test-workflow-with-triggers.js",
15
- "test:workflow:direct": "npm run build && node test-direct-middleware.js",
16
- "patch": "tsc && npm version patch && npm publish --access public && exit 0",
17
- "generate-docs": "NODE_OPTIONS='--loader ts-node/esm' ts-node schema-docs/docs.seeder.ts",
18
- "example:income": "NODE_OPTIONS='--loader ts-node/esm' ts-node examples/add-applicant-income.ts",
19
- "migrate:applicant-income": "node migrate-applicant-income.js",
20
- "migrate:self-employed-id": "node migrate-self-employed-id.js",
21
- "check:applicants-employment": "node check-applicants-without-employment.js",
22
- "delete:applications-by-type": "node delete-applications-by-type.js",
23
- "find:applications-many-audits": "node find-applications-with-many-audits.js",
24
- "update:apiconfigs-paths": "node scripts/update-apiconfigs-paths.js",
25
- "seed:property-metadata": "node scripts/seed-property-metadata.js"
26
- },
27
- "repository": {
28
- "type": "git",
29
- "url": "git+https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas.git"
30
- },
31
- "author": "Dynamatix",
32
- "license": "ISC",
33
- "bugs": {
34
- "url": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas/issues"
35
- },
36
- "homepage": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas#readme",
37
- "dependencies": {
38
- "@dynamatix/cat-shared": "^0.0.123",
39
- "@dynamatix/gb-schemas": "^1.3.256",
40
- "dotenv": "^16.4.5",
41
- "mongodb": "^6.14.2",
42
- "mongoose": "^8.9.5"
43
- },
44
- "files": [
45
- "dist"
46
- ],
47
- "exports": {
48
- ".": {
49
- "import": "./dist/index.js",
50
- "types": "./dist/index.d.ts"
51
- },
52
- "./applications": {
53
- "import": "./dist/applications/index.js",
54
- "types": "./dist/applications/index.d.ts"
55
- },
56
- "./applicants": {
57
- "import": "./dist/applicants/index.js",
58
- "types": "./dist/applicants/index.d.ts"
59
- },
60
- "./shared": {
61
- "import": "./dist/shared/index.js",
62
- "types": "./dist/shared/index.d.ts"
63
- },
64
- "./properties": {
65
- "import": "./dist/properties/index.js",
66
- "types": "./dist/properties/index.d.ts"
67
- },
68
- "./users": {
69
- "import": "./dist/users/index.js",
70
- "types": "./dist/users/index.d.ts"
71
- },
72
- "./product-catalogues": {
73
- "import": "./dist/product-catalogues/index.js",
74
- "types": "./dist/product-catalogues/index.d.ts"
75
- },
76
- "./underwriter": {
77
- "import": "./dist/underwriter/index.js",
78
- "types": "./dist/underwriter/index.d.ts"
79
- }
80
- },
81
- "devDependencies": {
82
- "@types/mongoose": "^5.11.96",
83
- "@types/node": "^22.14.0",
84
- "ts-node": "^10.9.2",
85
- "typescript": "^5.3.3"
86
- }
87
- }
1
+ {
2
+ "name": "@dynamatix/gb-schemas",
3
+ "version": "1.3.362-broker",
4
+ "description": "All the schemas for gatehouse bank back-end",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "test:workflow": "npm run build && node test-workflow.js",
12
+ "test:workflow:env": "npm run build && WORKFLOW_API_KEY=test-key WORKFLOW_API_URL=http://localhost:3000/api/workflows node test-workflow-with-env.js",
13
+ "example:app": "npm run build && node example-app-usage.js",
14
+ "test:workflow:triggers": "npm run build && node test-workflow-with-triggers.js",
15
+ "test:workflow:direct": "npm run build && node test-direct-middleware.js",
16
+ "patch": "tsc && npm version patch && npm publish --access public && exit 0",
17
+ "generate-docs": "NODE_OPTIONS='--loader ts-node/esm' ts-node schema-docs/docs.seeder.ts",
18
+ "example:income": "NODE_OPTIONS='--loader ts-node/esm' ts-node examples/add-applicant-income.ts",
19
+ "migrate:applicant-income": "node migrate-applicant-income.js",
20
+ "migrate:self-employed-id": "node migrate-self-employed-id.js",
21
+ "check:applicants-employment": "node check-applicants-without-employment.js",
22
+ "delete:applications-by-type": "node delete-applications-by-type.js",
23
+ "find:applications-many-audits": "node find-applications-with-many-audits.js",
24
+ "update:apiconfigs-paths": "node scripts/update-apiconfigs-paths.js",
25
+ "seed:property-metadata": "node scripts/seed-property-metadata.js"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas.git"
30
+ },
31
+ "author": "Dynamatix",
32
+ "license": "ISC",
33
+ "bugs": {
34
+ "url": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas/issues"
35
+ },
36
+ "homepage": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas#readme",
37
+ "dependencies": {
38
+ "@dynamatix/cat-shared": "^0.0.123",
39
+ "@dynamatix/gb-schemas": "^1.3.256",
40
+ "dotenv": "^16.4.5",
41
+ "mongodb": "^6.14.2",
42
+ "mongoose": "^8.9.5"
43
+ },
44
+ "files": [
45
+ "dist"
46
+ ],
47
+ "exports": {
48
+ ".": {
49
+ "import": "./dist/index.js",
50
+ "types": "./dist/index.d.ts"
51
+ },
52
+ "./applications": {
53
+ "import": "./dist/applications/index.js",
54
+ "types": "./dist/applications/index.d.ts"
55
+ },
56
+ "./applicants": {
57
+ "import": "./dist/applicants/index.js",
58
+ "types": "./dist/applicants/index.d.ts"
59
+ },
60
+ "./shared": {
61
+ "import": "./dist/shared/index.js",
62
+ "types": "./dist/shared/index.d.ts"
63
+ },
64
+ "./properties": {
65
+ "import": "./dist/properties/index.js",
66
+ "types": "./dist/properties/index.d.ts"
67
+ },
68
+ "./users": {
69
+ "import": "./dist/users/index.js",
70
+ "types": "./dist/users/index.d.ts"
71
+ },
72
+ "./product-catalogues": {
73
+ "import": "./dist/product-catalogues/index.js",
74
+ "types": "./dist/product-catalogues/index.d.ts"
75
+ },
76
+ "./underwriter": {
77
+ "import": "./dist/underwriter/index.js",
78
+ "types": "./dist/underwriter/index.d.ts"
79
+ }
80
+ },
81
+ "devDependencies": {
82
+ "@types/mongoose": "^5.11.96",
83
+ "@types/node": "^22.14.0",
84
+ "ts-node": "^10.9.2",
85
+ "typescript": "^5.3.3"
86
+ }
87
+ }