@dynamatix/gb-schemas 2.3.272 → 2.3.274
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAulBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
|
|
@@ -237,14 +237,60 @@ welcomeCallSchema.virtual('customerCurrentResidentialAddress').get(function () {
|
|
|
237
237
|
applicant.addressLine2,
|
|
238
238
|
applicant.addressLine3,
|
|
239
239
|
applicant.addressCity,
|
|
240
|
-
applicant.
|
|
241
|
-
|
|
240
|
+
applicant.propertyAddressCountry,
|
|
241
|
+
applicant.addressPostCode
|
|
242
242
|
].filter(part => part && part.trim() !== '');
|
|
243
243
|
return addressParts.join(', ');
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
return null;
|
|
247
247
|
});
|
|
248
|
+
// Virtual property for applicant employer/business name based on income settings
|
|
249
|
+
welcomeCallSchema.virtual('applicantEmployerBusinessName').get(function () {
|
|
250
|
+
if (this.applicantId && typeof this.applicantId === 'object') {
|
|
251
|
+
const applicant = this.applicantId;
|
|
252
|
+
// Check if applicant has income settings
|
|
253
|
+
if (applicant.incomeSourceId && typeof applicant.incomeSourceId === 'object') {
|
|
254
|
+
const incomeSettings = applicant.incomeSourceId;
|
|
255
|
+
// If incomeFromEmployment is false, return N/A
|
|
256
|
+
if (!incomeSettings.incomeFromEmployment)
|
|
257
|
+
return 'N/A';
|
|
258
|
+
// Check employment status to determine if employed or self-employed
|
|
259
|
+
if (incomeSettings.employmentStatusLid && typeof incomeSettings.employmentStatusLid === 'object') {
|
|
260
|
+
const employmentStatus = incomeSettings.employmentStatusLid;
|
|
261
|
+
const statusName = employmentStatus.name;
|
|
262
|
+
// Check if it's employed status - compare by name for stability
|
|
263
|
+
if (statusName === 'Employee with no shareholding' ||
|
|
264
|
+
statusName === 'A non-equity partner in a partnership' ||
|
|
265
|
+
statusName === 'A shareholder with less than 25% shares') {
|
|
266
|
+
// Check employment information
|
|
267
|
+
if (applicant.employmentInformationId && typeof applicant.employmentInformationId === 'object') {
|
|
268
|
+
const employment = applicant.employmentInformationId;
|
|
269
|
+
if (employment.employerName && employment.employerName.trim() !== '') {
|
|
270
|
+
return employment.employerName;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Check if it's self-employed or solo trader status - compare by name for stability
|
|
275
|
+
else if (statusName === 'A shareholder with 25% or more shares' ||
|
|
276
|
+
statusName === 'An equity partner in a partnership' ||
|
|
277
|
+
statusName === 'Sole Trader') {
|
|
278
|
+
// Check self-employment information
|
|
279
|
+
if (applicant.selfEmployedInformationId && typeof applicant.selfEmployedInformationId === 'object') {
|
|
280
|
+
const selfEmployment = applicant.selfEmployedInformationId;
|
|
281
|
+
if (selfEmployment.nameOfBusiness && selfEmployment.nameOfBusiness.trim() !== '') {
|
|
282
|
+
return selfEmployment.nameOfBusiness;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
console.log('No employment status found');
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return 'N/A';
|
|
293
|
+
});
|
|
248
294
|
// Virtual property for Customer's Contact Numbers (Phone and Mobile)
|
|
249
295
|
welcomeCallSchema.virtual('customerContactNumbers').get(function () {
|
|
250
296
|
if (this.applicantId && typeof this.applicantId === 'object') {
|
|
@@ -262,11 +308,19 @@ welcomeCallSchema.virtual('customerContactNumbers').get(function () {
|
|
|
262
308
|
}
|
|
263
309
|
return null;
|
|
264
310
|
});
|
|
265
|
-
// Virtual property for
|
|
266
|
-
welcomeCallSchema.virtual('
|
|
267
|
-
|
|
268
|
-
if (this.
|
|
269
|
-
|
|
311
|
+
// Virtual property for other applicants name and DOB in the requested format
|
|
312
|
+
welcomeCallSchema.virtual('otherApplicantsNameAndDOB').get(function () {
|
|
313
|
+
let application = null;
|
|
314
|
+
if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
|
|
315
|
+
application = this.applicantId.applicationId;
|
|
316
|
+
}
|
|
317
|
+
else if (this.applicationId && typeof this.applicationId === 'object') {
|
|
318
|
+
application = this.applicationId;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
return 'N/A';
|
|
322
|
+
}
|
|
323
|
+
if (application) {
|
|
270
324
|
// Get all applicants from the application (field name is 'applicants')
|
|
271
325
|
if (application.applicants && Array.isArray(application.applicants) && application.applicants.length > 0) {
|
|
272
326
|
// Get current applicant ID for comparison
|
|
@@ -280,7 +334,7 @@ welcomeCallSchema.virtual('allApplicantsNameAndDOB').get(function () {
|
|
|
280
334
|
if (otherApplicants.length === 0) {
|
|
281
335
|
return 'N/A';
|
|
282
336
|
}
|
|
283
|
-
// Format each other applicant as:
|
|
337
|
+
// Format each other applicant as: "First and middle names, last name, Date of birth"
|
|
284
338
|
const formattedApplicants = otherApplicants.map((applicant) => {
|
|
285
339
|
// Check if applicant is an ObjectId (not populated)
|
|
286
340
|
if (typeof applicant === 'string' || (applicant.constructor && applicant.constructor.name === 'ObjectId')) {
|
|
@@ -289,8 +343,8 @@ welcomeCallSchema.virtual('allApplicantsNameAndDOB').get(function () {
|
|
|
289
343
|
const firstName = applicant.firstName || '';
|
|
290
344
|
const middleName = applicant.middleName || '';
|
|
291
345
|
const lastName = applicant.lastName || '';
|
|
292
|
-
// Combine first and middle names
|
|
293
|
-
const fullFirstName = middleName ? `${firstName}
|
|
346
|
+
// Combine first and middle names with space
|
|
347
|
+
const fullFirstName = middleName ? `${firstName} ${middleName}` : firstName;
|
|
294
348
|
// Format date of birth to dd/mm/yyyy
|
|
295
349
|
let formattedDOB = '';
|
|
296
350
|
if (applicant.dateOfBirth) {
|
|
@@ -319,8 +373,9 @@ welcomeCallSchema.virtual('allApplicantsNameAndDOB').get(function () {
|
|
|
319
373
|
}
|
|
320
374
|
}
|
|
321
375
|
}
|
|
322
|
-
|
|
323
|
-
|
|
376
|
+
// Format as "First and middle names, last name, Date of birth"
|
|
377
|
+
return `${fullFirstName}, ${lastName}, ${formattedDOB}`;
|
|
378
|
+
}).filter((line) => line && line.trim() !== ', ,' && line.trim() !== '');
|
|
324
379
|
// Join all applicants with newline
|
|
325
380
|
return formattedApplicants.join('\n');
|
|
326
381
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.model.d.ts","sourceRoot":"","sources":["../../shared/lookup.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"lookup.model.d.ts","sourceRoot":"","sources":["../../shared/lookup.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAgChC,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyC,CAAC;AAC3D,eAAe,WAAW,CAAC"}
|
|
@@ -22,5 +22,6 @@ lookupSchema.index({ value: 1 });
|
|
|
22
22
|
lookupSchema.index({ name: 1 }, { collation: { locale: "en", strength: 2 } });
|
|
23
23
|
// Compound index for lookupGroupId + name queries
|
|
24
24
|
lookupSchema.index({ lookupGroupId: 1, name: 1 }, { collation: { locale: "en", strength: 2 } });
|
|
25
|
+
lookupSchema.index({ lookupGroupId: 1, value: 1 });
|
|
25
26
|
const LookupModel = mongoose.model('Lookup', lookupSchema);
|
|
26
27
|
export default LookupModel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamatix/gb-schemas",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.274",
|
|
4
4
|
"description": "All the schemas for gatehouse bank back-end",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@dynamatix/cat-shared": "^0.0.
|
|
38
|
+
"@dynamatix/cat-shared": "^0.0.127",
|
|
39
39
|
"dotenv": "^16.4.5",
|
|
40
40
|
"mongodb": "^6.14.2",
|
|
41
41
|
"mongoose": "^8.9.5"
|