@dynamatix/gb-schemas 1.3.330 โ 1.3.332
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 +286 -286
- package/dist/applicants/applicant-credit-report.model.d.ts +6 -0
- package/dist/applicants/applicant-credit-report.model.d.ts.map +1 -1
- package/dist/applicants/applicant-credit-report.model.js +1 -0
- package/dist/applicants/applicant-welcome-call.model.d.ts +126 -126
- package/dist/applicants/applicant-welcome-call.model.js +21 -21
- package/dist/shared/api-log.model.d.ts +118 -0
- package/dist/shared/api-log.model.d.ts.map +1 -0
- package/dist/shared/api-log.model.js +21 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/package.json +81 -81
- package/dist/applicants/applicant-income.model.d.ts +0 -2558
- package/dist/applicants/applicant-income.model.d.ts.map +0 -1
- package/dist/applications/application-document.model.d.ts +0 -186
- package/dist/applications/application-document.model.d.ts.map +0 -1
- package/dist/applications/document.model.d.ts +0 -186
- package/dist/applications/document.model.d.ts.map +0 -1
- package/dist/shared/document-type-model.d.ts +0 -76
- package/dist/shared/document-type-model.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,287 +1,287 @@
|
|
|
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
|
-
- **Custom Value Objects**: Specialized types for financial data (Pound, Account Number, Sort Code)
|
|
24
|
-
- **Modular Architecture**: Organized into logical domains (applications, applicants, properties, etc.)
|
|
25
|
-
- **Migration Scripts**: Comprehensive data migration and maintenance tools
|
|
26
|
-
|
|
27
|
-
## ๐ Project Structure
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
gb-schemas-node/
|
|
31
|
-
โโโ applicants/ # Applicant-related schemas and models
|
|
32
|
-
โโโ applications/ # Application management schemas
|
|
33
|
-
โโโ properties/ # Property and security schemas
|
|
34
|
-
โโโ product-catalogues/ # Product definition schemas
|
|
35
|
-
โโโ shared/ # Common/shared schemas and utilities
|
|
36
|
-
โโโ users/ # User management schemas
|
|
37
|
-
โโโ underwriter/ # Underwriting-related schemas
|
|
38
|
-
โโโ value-objects/ # Custom Mongoose types
|
|
39
|
-
โโโ api-models/ # API-specific model definitions
|
|
40
|
-
โโโ entities/ # Entity layer schemas
|
|
41
|
-
โโโ examples/ # Usage examples
|
|
42
|
-
โโโ scripts/ # Migration and utility scripts
|
|
43
|
-
โโโ schema-docs/ # Schema documentation generation
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## ๐ง Installation
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npm install @dynamatix/gb-schemas
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## ๐ Usage
|
|
53
|
-
|
|
54
|
-
### Basic Import
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
import {
|
|
58
|
-
ApplicantModel,
|
|
59
|
-
ApplicationModel,
|
|
60
|
-
PropertyModel
|
|
61
|
-
} from '@dynamatix/gb-schemas';
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Modular Imports
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
// Import specific modules
|
|
68
|
-
import { ApplicantModel } from '@dynamatix/gb-schemas/applicants';
|
|
69
|
-
import { ApplicationModel } from '@dynamatix/gb-schemas/applications';
|
|
70
|
-
import { PropertyModel } from '@dynamatix/gb-schemas/properties';
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Example: Adding Applicant Income
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
import mongoose from 'mongoose';
|
|
77
|
-
import ApplicantIncomeModel from '@dynamatix/gb-schemas/applicants/applicant-income.model';
|
|
78
|
-
|
|
79
|
-
// Connect to MongoDB
|
|
80
|
-
await mongoose.connect(MONGODB_URI);
|
|
81
|
-
|
|
82
|
-
// Create new applicant income record
|
|
83
|
-
const newIncome = new ApplicantIncomeModel({
|
|
84
|
-
applicantId: 'your-applicant-id',
|
|
85
|
-
selfEmployedIncomeRationale: 'Based on last 2 years of accounts'
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const savedIncome = await newIncome.save();
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## ๐๏ธ Core Schemas
|
|
92
|
-
|
|
93
|
-
### Applicants
|
|
94
|
-
- **Applicant**: Core applicant information (personal details, addresses, employment status)
|
|
95
|
-
- **Applicant Income**: Various income types (employment, self-employed, pension, property)
|
|
96
|
-
- **Applicant Commitments**: Financial commitments (mortgages, loans, credit cards)
|
|
97
|
-
- **Applicant Credit Data**: Credit profile and credit report information
|
|
98
|
-
- **Applicant Expenditure**: Spending patterns and financial outgoings
|
|
99
|
-
|
|
100
|
-
### Applications
|
|
101
|
-
- **Application**: Main application record with workflow and status tracking
|
|
102
|
-
- **Application Mortgage**: Mortgage-specific application details
|
|
103
|
-
- **Application Credit Profile**: Credit assessment information
|
|
104
|
-
- **Application Legal**: Legal documentation and compliance data
|
|
105
|
-
- **Application Notes**: Application-related notes and comments
|
|
106
|
-
|
|
107
|
-
### Properties
|
|
108
|
-
- **Property**: Property details and characteristics
|
|
109
|
-
- **Security**: Security and collateral information
|
|
110
|
-
|
|
111
|
-
### Product Catalogues
|
|
112
|
-
- **Product Catalogue**: Product definitions and variants
|
|
113
|
-
- **Product Definitions**: Detailed product specifications
|
|
114
|
-
- **Product Variants**: Product customization options
|
|
115
|
-
|
|
116
|
-
### Shared Models
|
|
117
|
-
- **Lookup**: Reference data and lookup values
|
|
118
|
-
- **System Parameters**: Configuration and system settings
|
|
119
|
-
- **Tasks**: Workflow task management
|
|
120
|
-
- **Alerts**: System notification system
|
|
121
|
-
|
|
122
|
-
## ๐ฐ Custom Value Objects
|
|
123
|
-
|
|
124
|
-
### Pound Type
|
|
125
|
-
Custom Mongoose type for handling UK currency values with automatic formatting and validation.
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
|
-
import { Pound, formatPound } from '@dynamatix/gb-schemas/value-objects/pound';
|
|
129
|
-
|
|
130
|
-
// Automatically handles currency formatting and validation
|
|
131
|
-
const amount = new Pound('1,234.56'); // Returns 1234.56
|
|
132
|
-
const formatted = formatPound(1234.56); // Returns "ยฃ1,234.56"
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Account Number & Sort Code
|
|
136
|
-
Specialized types for UK banking information with validation.
|
|
137
|
-
|
|
138
|
-
## ๐ Migration Scripts
|
|
139
|
-
|
|
140
|
-
The project includes comprehensive migration and maintenance scripts:
|
|
141
|
-
|
|
142
|
-
### Available Scripts
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Income migration
|
|
146
|
-
npm run migrate:applicant-income
|
|
147
|
-
|
|
148
|
-
# Self-employed ID migration
|
|
149
|
-
npm run migrate:self-employed-id
|
|
150
|
-
|
|
151
|
-
# Employment verification
|
|
152
|
-
npm run check:applicants-employment
|
|
153
|
-
|
|
154
|
-
# Application cleanup
|
|
155
|
-
npm run delete:applications-by-type
|
|
156
|
-
|
|
157
|
-
# API config updates
|
|
158
|
-
npm run update:apiconfigs-paths
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Key Migration Scripts
|
|
162
|
-
|
|
163
|
-
- **`migrate-applicant-income.js`**: Migrates from old income model to new separated models
|
|
164
|
-
- **`migrate-self-employed-id.js`**: Updates self-employed applicant references
|
|
165
|
-
- **`check-applicants-without-employment.js`**: Validates employment data integrity
|
|
166
|
-
- **`update-apiconfigs-paths.js`**: Updates API configuration paths
|
|
167
|
-
|
|
168
|
-
## ๐ ๏ธ Development
|
|
169
|
-
|
|
170
|
-
### Prerequisites
|
|
171
|
-
|
|
172
|
-
- Node.js (v18+)
|
|
173
|
-
- TypeScript 5.3+
|
|
174
|
-
- MongoDB 6.14+
|
|
175
|
-
|
|
176
|
-
### Setup
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# Install dependencies
|
|
180
|
-
npm install
|
|
181
|
-
|
|
182
|
-
# Build the project
|
|
183
|
-
npm run build
|
|
184
|
-
|
|
185
|
-
# Generate documentation
|
|
186
|
-
npm run generate-docs
|
|
187
|
-
|
|
188
|
-
# Run examples
|
|
189
|
-
npm run example:income
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Build Configuration
|
|
193
|
-
|
|
194
|
-
The project uses TypeScript with ES2020 modules and generates declaration files:
|
|
195
|
-
|
|
196
|
-
```json
|
|
197
|
-
{
|
|
198
|
-
"target": "ES2020",
|
|
199
|
-
"module": "ES2020",
|
|
200
|
-
"outDir": "./dist",
|
|
201
|
-
"declaration": true,
|
|
202
|
-
"declarationMap": true
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## ๐ API Reference
|
|
207
|
-
|
|
208
|
-
### Main Exports
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
// Core models
|
|
212
|
-
export * from './applications';
|
|
213
|
-
export * from './applicants';
|
|
214
|
-
export * from './properties';
|
|
215
|
-
export * from './shared';
|
|
216
|
-
export * from './users';
|
|
217
|
-
export * from './product-catalogues';
|
|
218
|
-
export * from './underwriter';
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Model Relationships
|
|
222
|
-
|
|
223
|
-
- **Applications** โ **Applicants** (one-to-many)
|
|
224
|
-
- **Applications** โ **Properties** (one-to-many)
|
|
225
|
-
- **Applications** โ **Product** (many-to-one)
|
|
226
|
-
- **Applicants** โ **Income Models** (one-to-many)
|
|
227
|
-
- **Applicants** โ **Commitment Models** (one-to-many)
|
|
228
|
-
|
|
229
|
-
## ๐ Security & Compliance
|
|
230
|
-
|
|
231
|
-
- **GDPR Support**: Built-in GDPR consent tracking
|
|
232
|
-
- **Audit Trail**: Comprehensive audit logging via middleware
|
|
233
|
-
- **Data Validation**: Strict schema validation and type checking
|
|
234
|
-
- **Access Control**: User permission and role-based access models
|
|
235
|
-
|
|
236
|
-
## ๐งช Testing & Examples
|
|
237
|
-
|
|
238
|
-
### Example Scripts
|
|
239
|
-
|
|
240
|
-
- **`add-applicant-income.ts`**: Demonstrates creating applicant income records
|
|
241
|
-
- **Migration Scripts**: Show real-world data migration patterns
|
|
242
|
-
|
|
243
|
-
### Running Examples
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
# Run income example
|
|
247
|
-
npm run example:income
|
|
248
|
-
|
|
249
|
-
# Generate documentation
|
|
250
|
-
npm run generate-docs
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## ๐ Documentation
|
|
254
|
-
|
|
255
|
-
- **Schema Documentation**: Auto-generated via `npm run generate-docs`
|
|
256
|
-
- **Migration Guides**: Detailed README files in the `scripts/` directory
|
|
257
|
-
- **API Models**: Type-safe API model definitions
|
|
258
|
-
|
|
259
|
-
## ๐ค Contributing
|
|
260
|
-
|
|
261
|
-
1. Fork the repository
|
|
262
|
-
2. Create a feature branch
|
|
263
|
-
3. Make your changes
|
|
264
|
-
4. Ensure TypeScript compilation passes
|
|
265
|
-
5. Submit a pull request
|
|
266
|
-
|
|
267
|
-
## ๐ License
|
|
268
|
-
|
|
269
|
-
ISC License - see package.json for details
|
|
270
|
-
|
|
271
|
-
## ๐ Support
|
|
272
|
-
|
|
273
|
-
- **Issues**: [GitHub Issues](https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas/issues)
|
|
274
|
-
- **Repository**: [GitHub Repository](https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas)
|
|
275
|
-
- **Author**: Dynamatix
|
|
276
|
-
|
|
277
|
-
## ๐ Version History
|
|
278
|
-
|
|
279
|
-
- **Current**: 1.3.305
|
|
280
|
-
- **Dependencies**:
|
|
281
|
-
- `@dynamatix/cat-shared`: ^0.0.119
|
|
282
|
-
- `mongoose`: ^8.9.5
|
|
283
|
-
- `mongodb`: ^6.14.2
|
|
284
|
-
|
|
285
|
-
---
|
|
286
|
-
|
|
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
|
+
- **Custom Value Objects**: Specialized types for financial data (Pound, Account Number, Sort Code)
|
|
24
|
+
- **Modular Architecture**: Organized into logical domains (applications, applicants, properties, etc.)
|
|
25
|
+
- **Migration Scripts**: Comprehensive data migration and maintenance tools
|
|
26
|
+
|
|
27
|
+
## ๐ Project Structure
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
gb-schemas-node/
|
|
31
|
+
โโโ applicants/ # Applicant-related schemas and models
|
|
32
|
+
โโโ applications/ # Application management schemas
|
|
33
|
+
โโโ properties/ # Property and security schemas
|
|
34
|
+
โโโ product-catalogues/ # Product definition schemas
|
|
35
|
+
โโโ shared/ # Common/shared schemas and utilities
|
|
36
|
+
โโโ users/ # User management schemas
|
|
37
|
+
โโโ underwriter/ # Underwriting-related schemas
|
|
38
|
+
โโโ value-objects/ # Custom Mongoose types
|
|
39
|
+
โโโ api-models/ # API-specific model definitions
|
|
40
|
+
โโโ entities/ # Entity layer schemas
|
|
41
|
+
โโโ examples/ # Usage examples
|
|
42
|
+
โโโ scripts/ # Migration and utility scripts
|
|
43
|
+
โโโ schema-docs/ # Schema documentation generation
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## ๐ง Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install @dynamatix/gb-schemas
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## ๐ Usage
|
|
53
|
+
|
|
54
|
+
### Basic Import
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import {
|
|
58
|
+
ApplicantModel,
|
|
59
|
+
ApplicationModel,
|
|
60
|
+
PropertyModel
|
|
61
|
+
} from '@dynamatix/gb-schemas';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Modular Imports
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Import specific modules
|
|
68
|
+
import { ApplicantModel } from '@dynamatix/gb-schemas/applicants';
|
|
69
|
+
import { ApplicationModel } from '@dynamatix/gb-schemas/applications';
|
|
70
|
+
import { PropertyModel } from '@dynamatix/gb-schemas/properties';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Example: Adding Applicant Income
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import mongoose from 'mongoose';
|
|
77
|
+
import ApplicantIncomeModel from '@dynamatix/gb-schemas/applicants/applicant-income.model';
|
|
78
|
+
|
|
79
|
+
// Connect to MongoDB
|
|
80
|
+
await mongoose.connect(MONGODB_URI);
|
|
81
|
+
|
|
82
|
+
// Create new applicant income record
|
|
83
|
+
const newIncome = new ApplicantIncomeModel({
|
|
84
|
+
applicantId: 'your-applicant-id',
|
|
85
|
+
selfEmployedIncomeRationale: 'Based on last 2 years of accounts'
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const savedIncome = await newIncome.save();
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## ๐๏ธ Core Schemas
|
|
92
|
+
|
|
93
|
+
### Applicants
|
|
94
|
+
- **Applicant**: Core applicant information (personal details, addresses, employment status)
|
|
95
|
+
- **Applicant Income**: Various income types (employment, self-employed, pension, property)
|
|
96
|
+
- **Applicant Commitments**: Financial commitments (mortgages, loans, credit cards)
|
|
97
|
+
- **Applicant Credit Data**: Credit profile and credit report information
|
|
98
|
+
- **Applicant Expenditure**: Spending patterns and financial outgoings
|
|
99
|
+
|
|
100
|
+
### Applications
|
|
101
|
+
- **Application**: Main application record with workflow and status tracking
|
|
102
|
+
- **Application Mortgage**: Mortgage-specific application details
|
|
103
|
+
- **Application Credit Profile**: Credit assessment information
|
|
104
|
+
- **Application Legal**: Legal documentation and compliance data
|
|
105
|
+
- **Application Notes**: Application-related notes and comments
|
|
106
|
+
|
|
107
|
+
### Properties
|
|
108
|
+
- **Property**: Property details and characteristics
|
|
109
|
+
- **Security**: Security and collateral information
|
|
110
|
+
|
|
111
|
+
### Product Catalogues
|
|
112
|
+
- **Product Catalogue**: Product definitions and variants
|
|
113
|
+
- **Product Definitions**: Detailed product specifications
|
|
114
|
+
- **Product Variants**: Product customization options
|
|
115
|
+
|
|
116
|
+
### Shared Models
|
|
117
|
+
- **Lookup**: Reference data and lookup values
|
|
118
|
+
- **System Parameters**: Configuration and system settings
|
|
119
|
+
- **Tasks**: Workflow task management
|
|
120
|
+
- **Alerts**: System notification system
|
|
121
|
+
|
|
122
|
+
## ๐ฐ Custom Value Objects
|
|
123
|
+
|
|
124
|
+
### Pound Type
|
|
125
|
+
Custom Mongoose type for handling UK currency values with automatic formatting and validation.
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { Pound, formatPound } from '@dynamatix/gb-schemas/value-objects/pound';
|
|
129
|
+
|
|
130
|
+
// Automatically handles currency formatting and validation
|
|
131
|
+
const amount = new Pound('1,234.56'); // Returns 1234.56
|
|
132
|
+
const formatted = formatPound(1234.56); // Returns "ยฃ1,234.56"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Account Number & Sort Code
|
|
136
|
+
Specialized types for UK banking information with validation.
|
|
137
|
+
|
|
138
|
+
## ๐ Migration Scripts
|
|
139
|
+
|
|
140
|
+
The project includes comprehensive migration and maintenance scripts:
|
|
141
|
+
|
|
142
|
+
### Available Scripts
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Income migration
|
|
146
|
+
npm run migrate:applicant-income
|
|
147
|
+
|
|
148
|
+
# Self-employed ID migration
|
|
149
|
+
npm run migrate:self-employed-id
|
|
150
|
+
|
|
151
|
+
# Employment verification
|
|
152
|
+
npm run check:applicants-employment
|
|
153
|
+
|
|
154
|
+
# Application cleanup
|
|
155
|
+
npm run delete:applications-by-type
|
|
156
|
+
|
|
157
|
+
# API config updates
|
|
158
|
+
npm run update:apiconfigs-paths
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Key Migration Scripts
|
|
162
|
+
|
|
163
|
+
- **`migrate-applicant-income.js`**: Migrates from old income model to new separated models
|
|
164
|
+
- **`migrate-self-employed-id.js`**: Updates self-employed applicant references
|
|
165
|
+
- **`check-applicants-without-employment.js`**: Validates employment data integrity
|
|
166
|
+
- **`update-apiconfigs-paths.js`**: Updates API configuration paths
|
|
167
|
+
|
|
168
|
+
## ๐ ๏ธ Development
|
|
169
|
+
|
|
170
|
+
### Prerequisites
|
|
171
|
+
|
|
172
|
+
- Node.js (v18+)
|
|
173
|
+
- TypeScript 5.3+
|
|
174
|
+
- MongoDB 6.14+
|
|
175
|
+
|
|
176
|
+
### Setup
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Install dependencies
|
|
180
|
+
npm install
|
|
181
|
+
|
|
182
|
+
# Build the project
|
|
183
|
+
npm run build
|
|
184
|
+
|
|
185
|
+
# Generate documentation
|
|
186
|
+
npm run generate-docs
|
|
187
|
+
|
|
188
|
+
# Run examples
|
|
189
|
+
npm run example:income
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Build Configuration
|
|
193
|
+
|
|
194
|
+
The project uses TypeScript with ES2020 modules and generates declaration files:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"target": "ES2020",
|
|
199
|
+
"module": "ES2020",
|
|
200
|
+
"outDir": "./dist",
|
|
201
|
+
"declaration": true,
|
|
202
|
+
"declarationMap": true
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## ๐ API Reference
|
|
207
|
+
|
|
208
|
+
### Main Exports
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// Core models
|
|
212
|
+
export * from './applications';
|
|
213
|
+
export * from './applicants';
|
|
214
|
+
export * from './properties';
|
|
215
|
+
export * from './shared';
|
|
216
|
+
export * from './users';
|
|
217
|
+
export * from './product-catalogues';
|
|
218
|
+
export * from './underwriter';
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Model Relationships
|
|
222
|
+
|
|
223
|
+
- **Applications** โ **Applicants** (one-to-many)
|
|
224
|
+
- **Applications** โ **Properties** (one-to-many)
|
|
225
|
+
- **Applications** โ **Product** (many-to-one)
|
|
226
|
+
- **Applicants** โ **Income Models** (one-to-many)
|
|
227
|
+
- **Applicants** โ **Commitment Models** (one-to-many)
|
|
228
|
+
|
|
229
|
+
## ๐ Security & Compliance
|
|
230
|
+
|
|
231
|
+
- **GDPR Support**: Built-in GDPR consent tracking
|
|
232
|
+
- **Audit Trail**: Comprehensive audit logging via middleware
|
|
233
|
+
- **Data Validation**: Strict schema validation and type checking
|
|
234
|
+
- **Access Control**: User permission and role-based access models
|
|
235
|
+
|
|
236
|
+
## ๐งช Testing & Examples
|
|
237
|
+
|
|
238
|
+
### Example Scripts
|
|
239
|
+
|
|
240
|
+
- **`add-applicant-income.ts`**: Demonstrates creating applicant income records
|
|
241
|
+
- **Migration Scripts**: Show real-world data migration patterns
|
|
242
|
+
|
|
243
|
+
### Running Examples
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Run income example
|
|
247
|
+
npm run example:income
|
|
248
|
+
|
|
249
|
+
# Generate documentation
|
|
250
|
+
npm run generate-docs
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## ๐ Documentation
|
|
254
|
+
|
|
255
|
+
- **Schema Documentation**: Auto-generated via `npm run generate-docs`
|
|
256
|
+
- **Migration Guides**: Detailed README files in the `scripts/` directory
|
|
257
|
+
- **API Models**: Type-safe API model definitions
|
|
258
|
+
|
|
259
|
+
## ๐ค Contributing
|
|
260
|
+
|
|
261
|
+
1. Fork the repository
|
|
262
|
+
2. Create a feature branch
|
|
263
|
+
3. Make your changes
|
|
264
|
+
4. Ensure TypeScript compilation passes
|
|
265
|
+
5. Submit a pull request
|
|
266
|
+
|
|
267
|
+
## ๐ License
|
|
268
|
+
|
|
269
|
+
ISC License - see package.json for details
|
|
270
|
+
|
|
271
|
+
## ๐ Support
|
|
272
|
+
|
|
273
|
+
- **Issues**: [GitHub Issues](https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas/issues)
|
|
274
|
+
- **Repository**: [GitHub Repository](https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas)
|
|
275
|
+
- **Author**: Dynamatix
|
|
276
|
+
|
|
277
|
+
## ๐ Version History
|
|
278
|
+
|
|
279
|
+
- **Current**: 1.3.305
|
|
280
|
+
- **Dependencies**:
|
|
281
|
+
- `@dynamatix/cat-shared`: ^0.0.119
|
|
282
|
+
- `mongoose`: ^8.9.5
|
|
283
|
+
- `mongodb`: ^6.14.2
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
287
|
*This package provides the foundational data layer for Gatehouse Bank's mortgage and financial services backend systems.*
|
|
@@ -38,6 +38,7 @@ declare const ApplicantCreditReportModel: mongoose.Model<{
|
|
|
38
38
|
securedArrears: string;
|
|
39
39
|
unsecuredArrears: string;
|
|
40
40
|
bankruptcyOrIva: string;
|
|
41
|
+
notMapped: any;
|
|
41
42
|
aliasNames: mongoose.Types.DocumentArray<{
|
|
42
43
|
dob: string;
|
|
43
44
|
forename: string;
|
|
@@ -570,6 +571,7 @@ declare const ApplicantCreditReportModel: mongoose.Model<{
|
|
|
570
571
|
securedArrears: string;
|
|
571
572
|
unsecuredArrears: string;
|
|
572
573
|
bankruptcyOrIva: string;
|
|
574
|
+
notMapped: any;
|
|
573
575
|
aliasNames: mongoose.Types.DocumentArray<{
|
|
574
576
|
dob: string;
|
|
575
577
|
forename: string;
|
|
@@ -1102,6 +1104,7 @@ declare const ApplicantCreditReportModel: mongoose.Model<{
|
|
|
1102
1104
|
securedArrears: string;
|
|
1103
1105
|
unsecuredArrears: string;
|
|
1104
1106
|
bankruptcyOrIva: string;
|
|
1107
|
+
notMapped: any;
|
|
1105
1108
|
aliasNames: mongoose.Types.DocumentArray<{
|
|
1106
1109
|
dob: string;
|
|
1107
1110
|
forename: string;
|
|
@@ -1638,6 +1641,7 @@ declare const ApplicantCreditReportModel: mongoose.Model<{
|
|
|
1638
1641
|
securedArrears: string;
|
|
1639
1642
|
unsecuredArrears: string;
|
|
1640
1643
|
bankruptcyOrIva: string;
|
|
1644
|
+
notMapped: any;
|
|
1641
1645
|
aliasNames: mongoose.Types.DocumentArray<{
|
|
1642
1646
|
dob: string;
|
|
1643
1647
|
forename: string;
|
|
@@ -2170,6 +2174,7 @@ declare const ApplicantCreditReportModel: mongoose.Model<{
|
|
|
2170
2174
|
securedArrears: string;
|
|
2171
2175
|
unsecuredArrears: string;
|
|
2172
2176
|
bankruptcyOrIva: string;
|
|
2177
|
+
notMapped: any;
|
|
2173
2178
|
aliasNames: mongoose.Types.DocumentArray<{
|
|
2174
2179
|
dob: string;
|
|
2175
2180
|
forename: string;
|
|
@@ -2702,6 +2707,7 @@ declare const ApplicantCreditReportModel: mongoose.Model<{
|
|
|
2702
2707
|
securedArrears: string;
|
|
2703
2708
|
unsecuredArrears: string;
|
|
2704
2709
|
bankruptcyOrIva: string;
|
|
2710
|
+
notMapped: any;
|
|
2705
2711
|
aliasNames: mongoose.Types.DocumentArray<{
|
|
2706
2712
|
dob: string;
|
|
2707
2713
|
forename: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-credit-report.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-credit-report.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"applicant-credit-report.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-credit-report.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA6GhC,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAuE,CAAC;AACxG,eAAe,0BAA0B,CAAC"}
|
|
@@ -80,6 +80,7 @@ const applicantCreditReportSchema = new Schema({
|
|
|
80
80
|
securedArrears: { type: String, default: "" },
|
|
81
81
|
unsecuredArrears: { type: String, default: "" },
|
|
82
82
|
bankruptcyOrIva: { type: String, default: "" },
|
|
83
|
+
notMapped: { type: mongoose.Schema.Types.Mixed, default: null },
|
|
83
84
|
aliasNames: [aliasNameSchema],
|
|
84
85
|
associates: [associateSchema],
|
|
85
86
|
linkedAddressData: [addressSpecificData],
|