@dynamatix/gb-schemas 1.3.331 โ†’ 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 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.*