@dynamatix/gb-schemas 2.3.271 → 2.3.273

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/applicants/applicant-additional-income.model.d.ts.map +1 -1
  2. package/dist/applicants/applicant-additional-income.model.js +3 -0
  3. package/dist/applicants/applicant-commitment-creditCard.model.d.ts.map +1 -1
  4. package/dist/applicants/applicant-commitment-creditCard.model.js +3 -0
  5. package/dist/applicants/applicant-commitment-loan.model.d.ts.map +1 -1
  6. package/dist/applicants/applicant-commitment-loan.model.js +2 -0
  7. package/dist/applicants/applicant-commitment-mortgage.model.d.ts.map +1 -1
  8. package/dist/applicants/applicant-commitment-mortgage.model.js +3 -0
  9. package/dist/applicants/applicant-commitment-residence.model.d.ts.map +1 -1
  10. package/dist/applicants/applicant-commitment-residence.model.js +2 -0
  11. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts.map +1 -1
  12. package/dist/applicants/applicant-commitment-secureLoan.model.js +3 -0
  13. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts.map +1 -1
  14. package/dist/applicants/applicant-commitment-unsecuredLoan.model.js +3 -0
  15. package/dist/applicants/applicant-credit-report.model.js +1 -0
  16. package/dist/applicants/applicant-employment-income.model.d.ts.map +1 -1
  17. package/dist/applicants/applicant-employment-income.model.js +3 -0
  18. package/dist/applicants/applicant-expenditure.model.d.ts.map +1 -1
  19. package/dist/applicants/applicant-expenditure.model.js +3 -0
  20. package/dist/applicants/applicant-income-settings.model.d.ts.map +1 -1
  21. package/dist/applicants/applicant-income-settings.model.js +1 -0
  22. package/dist/applicants/applicant-income-summary.model.d.ts.map +1 -1
  23. package/dist/applicants/applicant-income-summary.model.js +2 -0
  24. package/dist/applicants/applicant-pension-income.model.d.ts.map +1 -1
  25. package/dist/applicants/applicant-pension-income.model.js +2 -0
  26. package/dist/applicants/applicant-property-income.model.d.ts.map +1 -1
  27. package/dist/applicants/applicant-property-income.model.js +1 -0
  28. package/dist/applicants/applicant-self-employed-income.model.d.ts.map +1 -1
  29. package/dist/applicants/applicant-self-employed-income.model.js +1 -0
  30. package/dist/applicants/applicant-self-employment.model.d.ts.map +1 -1
  31. package/dist/applicants/applicant-self-employment.model.js +2 -0
  32. package/dist/applicants/applicant-sole-trader-income.model.d.ts.map +1 -1
  33. package/dist/applicants/applicant-sole-trader-income.model.js +1 -0
  34. package/dist/applicants/applicant-uk-tax-credits.model.d.ts.map +1 -1
  35. package/dist/applicants/applicant-uk-tax-credits.model.js +2 -0
  36. package/dist/applicants/applicant-welcome-call.model.d.ts.map +1 -1
  37. package/dist/applicants/applicant-welcome-call.model.js +5 -117
  38. package/dist/applicants/applicant.model.d.ts.map +1 -1
  39. package/dist/applicants/applicant.model.js +14 -0
  40. package/dist/applications/application-direct-debit.model.js +2 -0
  41. package/dist/applications/application-euc.model.d.ts.map +1 -1
  42. package/dist/applications/application-euc.model.js +2 -0
  43. package/dist/applications/application-mortgage.model.js +2 -0
  44. package/dist/applications/application-note.model.d.ts.map +1 -1
  45. package/dist/applications/application-note.model.js +18 -0
  46. package/dist/applications/application-product.model.d.ts.map +1 -1
  47. package/dist/applications/application-product.model.js +3 -0
  48. package/dist/applications/application.model.d.ts.map +1 -1
  49. package/dist/applications/application.model.js +11 -0
  50. package/dist/applications/applications-task.model.d.ts.map +1 -1
  51. package/dist/applications/applications-task.model.js +3 -0
  52. package/dist/product-catalogues/product-catalogue.model.d.ts.map +1 -1
  53. package/dist/product-catalogues/product-catalogue.model.js +1 -0
  54. package/dist/product-catalogues/product-variant.model.d.ts.map +1 -1
  55. package/dist/product-catalogues/product-variant.model.js +1 -0
  56. package/dist/properties/security.model.d.ts.map +1 -1
  57. package/dist/properties/security.model.js +4 -0
  58. package/dist/shared/api-log.model.d.ts +6 -0
  59. package/dist/shared/api-log.model.d.ts.map +1 -1
  60. package/dist/shared/api-log.model.js +4 -0
  61. package/dist/shared/apprivo-sync-journey.model.d.ts.map +1 -1
  62. package/dist/shared/apprivo-sync-journey.model.js +2 -0
  63. package/dist/shared/checklist.model.d.ts.map +1 -1
  64. package/dist/shared/checklist.model.js +5 -0
  65. package/dist/shared/lookup-group.model.d.ts.map +1 -1
  66. package/dist/shared/lookup-group.model.js +3 -0
  67. package/dist/shared/lookup.model.d.ts.map +1 -1
  68. package/dist/shared/lookup.model.js +6 -0
  69. package/dist/shared/webhook-event.model.d.ts.map +1 -1
  70. package/dist/shared/webhook-event.model.js +4 -0
  71. package/dist/users/auth-log.model.d.ts.map +1 -1
  72. package/dist/users/auth-log.model.js +3 -0
  73. package/dist/users/permission.model.d.ts.map +1 -1
  74. package/dist/users/permission.model.js +2 -0
  75. package/dist/users/role-group.model.d.ts.map +1 -1
  76. package/dist/users/role-group.model.js +3 -0
  77. package/dist/users/role.model.d.ts.map +1 -1
  78. package/dist/users/role.model.js +3 -0
  79. package/dist/users/user.model.d.ts.map +1 -1
  80. package/dist/users/user.model.js +10 -0
  81. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-additional-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-additional-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgC5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiF,CAAC;AAEtH,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"applicant-additional-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-additional-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAoC5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiF,CAAC;AAEtH,eAAe,8BAA8B,CAAC"}
@@ -28,5 +28,8 @@ const applicantAdditionalIncomeSchema = new mongoose.Schema({
28
28
  applyAuditMiddleware(applicantAdditionalIncomeSchema, "Applicant_Additional_Income");
29
29
  // Apply workflow plugin to the schema
30
30
  applyWorkflowPlugin(applicantAdditionalIncomeSchema, 'applicant_additional_income');
31
+ // Add indexes that exist in database but missing from model
32
+ applicantAdditionalIncomeSchema.index({ applicantId: 1 }); // Filter by applicant
33
+ applicantAdditionalIncomeSchema.index({ applicantId: 1, apprivoSoucrceNumberLid: 1 }); // Compound: applicant + source number
31
34
  const ApplicantAdditionalIncomeModel = mongoose.model("Applicant_Additional_Income", applicantAdditionalIncomeSchema);
32
35
  export default ApplicantAdditionalIncomeModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-creditCard.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-creditCard.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAuC/C,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqE,CAAC;AACrG,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"applicant-commitment-creditCard.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-creditCard.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AA2C/C,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqE,CAAC;AACrG,eAAe,yBAAyB,CAAC"}
@@ -33,5 +33,8 @@ creditCardCommitmentSchema.virtual('ApplicationId', {
33
33
  applyAuditMiddleware(creditCardCommitmentSchema, "CreditCardCommitment");
34
34
  // Apply workflow plugin to the schema
35
35
  applyWorkflowPlugin(creditCardCommitmentSchema, 'creditcardcommitment');
36
+ // Indexes for query optimization
37
+ creditCardCommitmentSchema.index({ applicantId: 1 });
38
+ creditCardCommitmentSchema.index({ applicantId: 1, isSelected: 1 });
36
39
  const CreditCardCommitmentModel = mongoose.model("CreditCardCommitment", creditCardCommitmentSchema);
37
40
  export default CreditCardCommitmentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-loan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-loan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAwD5D,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;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AyD,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
@@ -45,5 +45,7 @@ loanCommitmentSchema.virtual('lendingType').get(function () {
45
45
  applyAuditMiddleware(loanCommitmentSchema, "LoanCommitment");
46
46
  // Apply workflow plugin to the schema
47
47
  applyWorkflowPlugin(loanCommitmentSchema, 'loancommitment');
48
+ // Indexes for query optimization
49
+ loanCommitmentSchema.index({ applicantId: 1 });
48
50
  const LoanCommitmentModel = mongoose.model("LoanCommitment", loanCommitmentSchema);
49
51
  export default LoanCommitmentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-mortgage.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA0E5D,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiE,CAAC;AAC/F,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"applicant-commitment-mortgage.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA6E5D,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiE,CAAC;AAC/F,eAAe,uBAAuB,CAAC"}
@@ -62,5 +62,8 @@ mortgageCommitmentSchema.virtual('applicationType').get(function () {
62
62
  applyAuditMiddleware(mortgageCommitmentSchema, "MortgageCommitment");
63
63
  // Apply workflow plugin to the schema
64
64
  applyWorkflowPlugin(mortgageCommitmentSchema, 'mortgagecommitment');
65
+ // Indexes for query optimization
66
+ mortgageCommitmentSchema.index({ applicantId: 1 });
67
+ mortgageCommitmentSchema.index({ applicantId: 1, isSelected: 1 });
65
68
  const MortgageCommitmentModel = mongoose.model("MortgageCommitment", mortgageCommitmentSchema);
66
69
  export default MortgageCommitmentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-residence.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-residence.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA2D5D,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmE,CAAC;AAClG,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"applicant-commitment-residence.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-residence.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA6D5D,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmE,CAAC;AAClG,eAAe,wBAAwB,CAAC"}
@@ -51,5 +51,7 @@ const residenceCommitmentSchema = new mongoose.Schema({
51
51
  applyAuditMiddleware(residenceCommitmentSchema, "ResidenceCommitment");
52
52
  // Apply workflow plugin to the schema
53
53
  applyWorkflowPlugin(residenceCommitmentSchema, 'residencecommitment');
54
+ // Indexes for query optimization
55
+ residenceCommitmentSchema.index({ applicantId: 1 });
54
56
  const ResidenceCommitmentModel = mongoose.model("ResidenceCommitment", residenceCommitmentSchema);
55
57
  export default ResidenceCommitmentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-secureLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-secureLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA4C5D,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAuE,CAAC;AACxG,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"applicant-commitment-secureLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-secureLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgD5D,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAuE,CAAC;AACxG,eAAe,0BAA0B,CAAC"}
@@ -36,5 +36,8 @@ securedLoanCommitmentSchema.virtual('lendingType').get(function () {
36
36
  applyAuditMiddleware(securedLoanCommitmentSchema, "SecuredLoanCommitment");
37
37
  // Apply workflow plugin to the schema
38
38
  applyWorkflowPlugin(securedLoanCommitmentSchema, 'securedloancommitment');
39
+ // Indexes for query optimization
40
+ securedLoanCommitmentSchema.index({ applicantId: 1 });
41
+ securedLoanCommitmentSchema.index({ applicantId: 1, isSelected: 1 });
39
42
  const SecuredLoanCommitmentModel = mongoose.model("SecuredLoanCommitment", securedLoanCommitmentSchema);
40
43
  export default SecuredLoanCommitmentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-commitment-unsecuredLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-unsecuredLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA4C5D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2E,CAAC;AAC9G,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"applicant-commitment-unsecuredLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-unsecuredLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgD5D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2E,CAAC;AAC9G,eAAe,4BAA4B,CAAC"}
@@ -36,5 +36,8 @@ unsecuredLoanCommitmentSchema.virtual('lendingType').get(function () {
36
36
  applyAuditMiddleware(unsecuredLoanCommitmentSchema, "UnsecuredLoanCommitment");
37
37
  // Apply workflow plugin to the schema
38
38
  applyWorkflowPlugin(unsecuredLoanCommitmentSchema, 'unsecuredloancommitment');
39
+ // Indexes for query optimization
40
+ unsecuredLoanCommitmentSchema.index({ applicantId: 1 });
41
+ unsecuredLoanCommitmentSchema.index({ applicantId: 1, isSelected: 1 });
39
42
  const UnsecuredLoanCommitmentModel = mongoose.model("UnsecuredLoanCommitment", unsecuredLoanCommitmentSchema);
40
43
  export default UnsecuredLoanCommitmentModel;
@@ -111,6 +111,7 @@ const applicantCreditReportSchema = new Schema({
111
111
  noticeofCorrection: [noticeofCorrectionSchema],
112
112
  });
113
113
  // Apply workflow plugin to the schema
114
+ applicantCreditReportSchema.index({ applicantId: 1 });
114
115
  applyWorkflowPlugin(applicantCreditReportSchema, 'applicantcreditreport');
115
116
  const ApplicantCreditReportModel = mongoose.model("ApplicantCreditReport", applicantCreditReportSchema);
116
117
  export default ApplicantCreditReportModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-employment-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-employment-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAiB5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAgF,CAAC;AAErH,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"applicant-employment-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-employment-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAqB5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAgF,CAAC;AAErH,eAAe,8BAA8B,CAAC"}
@@ -13,5 +13,8 @@ applicantEmploymentIncomeSchema.virtual('incomeSourceId').get(function () {
13
13
  });
14
14
  // Apply workflow plugin to the schema
15
15
  applyWorkflowPlugin(applicantEmploymentIncomeSchema, 'applicantemploymentincome');
16
+ // Add indexes that exist in database but missing from model
17
+ applicantEmploymentIncomeSchema.index({ applicantId: 1 }); // Filter by applicant
18
+ applicantEmploymentIncomeSchema.index({ applicantId: 1, incomeTypeLid: 1 }); // Compound: applicant + income type
16
19
  const ApplicantEmploymentIncomeModel = mongoose.model("Applicant_EmploymentIncome", applicantEmploymentIncomeSchema);
17
20
  export default ApplicantEmploymentIncomeModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-expenditure.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-expenditure.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA0K5D,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAsE,CAAC;AACtG,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"applicant-expenditure.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-expenditure.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA6K5D,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAsE,CAAC;AACtG,eAAe,yBAAyB,CAAC"}
@@ -138,6 +138,9 @@ const virtualEssentialExpenditure = applicantExpenditureSchema.virtual("Expendit
138
138
  virtualEssentialExpenditure.description = "Populated lookup value for essential expenditure.";
139
139
  applyAuditMiddleware(applicantExpenditureSchema, "Applicant_Expenditure");
140
140
  // Apply workflow plugin to the schema
141
+ applicantExpenditureSchema.index({ applicantId: 1 });
142
+ applicantExpenditureSchema.index({ applicantId: 1, sectionName: 1 });
143
+ applicantExpenditureSchema.index({ expenditureTypeLid: 1 });
141
144
  applyWorkflowPlugin(applicantExpenditureSchema, 'applicant_expenditure');
142
145
  const ApplicantExpenditureModel = mongoose.model("Applicant_Expenditure", applicantExpenditureSchema);
143
146
  export default ApplicantExpenditureModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-income-settings.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-income-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAwBhC,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4E,CAAC;AAE/G,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"applicant-income-settings.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-income-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA0BhC,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4E,CAAC;AAE/G,eAAe,4BAA4B,CAAC"}
@@ -17,5 +17,6 @@ applicantIncomeSettingsSchema.virtual('lendingType').get(function () {
17
17
  applyAuditMiddleware(applicantIncomeSettingsSchema, "Applicant_IncomeSettings");
18
18
  // Apply workflow plugin to the schema
19
19
  applyWorkflowPlugin(applicantIncomeSettingsSchema, 'applicant_incomesettings');
20
+ applicantIncomeSettingsSchema.index({ applicantId: 1 });
20
21
  const ApplicantIncomeSettingsModel = mongoose.model("Applicant_IncomeSettings", applicantIncomeSettingsSchema);
21
22
  export default ApplicantIncomeSettingsModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-income-summary.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-income-summary.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA6C5D,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2E,CAAC;AAE7G,eAAe,2BAA2B,CAAC"}
@@ -37,5 +37,7 @@ const applicantIncomeSummarySchema = new mongoose.Schema({
37
37
  applyAuditMiddleware(applicantIncomeSummarySchema, "Applicant_Income_Summary");
38
38
  // Apply workflow plugin to the schema
39
39
  applyWorkflowPlugin(applicantIncomeSummarySchema, 'applicant_income_summary');
40
+ // Add indexes that exist in database but missing from model
41
+ applicantIncomeSummarySchema.index({ applicantId: 1 }, { unique: true }); // Filter by applicant - unique constraint
40
42
  const ApplicantIncomeSummaryModel = mongoose.model("Applicant_Income_Summary", applicantIncomeSummarySchema);
41
43
  export default ApplicantIncomeSummaryModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-pension-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-pension-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0E,CAAC;AAE7G,eAAe,4BAA4B,CAAC"}
@@ -29,5 +29,7 @@ applicantPensionIncomSchema.virtual('incomeSourceId').get(function () {
29
29
  });
30
30
  // Apply workflow plugin to the schema
31
31
  applyWorkflowPlugin(applicantPensionIncomSchema, 'applicant_pension_income');
32
+ // Add indexes that exist in database but missing from model
33
+ applicantPensionIncomSchema.index({ applicantId: 1 }); // Filter by applicant
32
34
  const EmploymentPensionIncomeModel = mongoose.model("Applicant_Pension_Income", applicantPensionIncomSchema);
33
35
  export default EmploymentPensionIncomeModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-property-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-property-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAqC5D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAoE,CAAC;AAEvG,eAAe,4BAA4B,CAAC"}
@@ -29,5 +29,6 @@ propertyIncomeSchema.virtual('incomeSourceId').get(function () {
29
29
  applyAuditMiddleware(propertyIncomeSchema, "Applicant_Property_Income");
30
30
  // Apply workflow plugin to the schema
31
31
  applyWorkflowPlugin(propertyIncomeSchema, 'applicant_property_income');
32
+ propertyIncomeSchema.index({ applicantId: 1 });
32
33
  const ApplicantPropertyIncomeModel = mongoose.model("Applicant_Property_Income", propertyIncomeSchema);
33
34
  export default ApplicantPropertyIncomeModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-self-employed-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-self-employed-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAuB5D,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6E,CAAC;AAEpH,eAAe,gCAAgC,CAAC"}
1
+ {"version":3,"file":"applicant-self-employed-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-self-employed-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAwB5D,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6E,CAAC;AAEpH,eAAe,gCAAgC,CAAC"}
@@ -17,6 +17,7 @@ selfEmployedIncomeSchema.virtual('incomeSourceId').get(function () {
17
17
  });
18
18
  applyAuditMiddleware(selfEmployedIncomeSchema, "Applicant_Self_Employed_Income");
19
19
  // Apply workflow plugin to the schema
20
+ selfEmployedIncomeSchema.index({ applicantId: 1 }); // Filter by applicant
20
21
  applyWorkflowPlugin(selfEmployedIncomeSchema, 'applicant_self_employed_income');
21
22
  const ApplicantSelfEmployedIncomeModel = mongoose.model("Applicant_Self_Employed_Income", selfEmployedIncomeSchema);
22
23
  export default ApplicantSelfEmployedIncomeModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-self-employment.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-self-employment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA2DhC,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6E,CAAC;AAEhH,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"applicant-self-employment.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-self-employment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA8DhC,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6E,CAAC;AAEhH,eAAe,4BAA4B,CAAC"}
@@ -49,5 +49,7 @@ const applicantSelfEmploymentSchema = new mongoose.Schema({
49
49
  });
50
50
  // Apply workflow plugin to the schema
51
51
  applyWorkflowPlugin(applicantSelfEmploymentSchema, 'applicant_self_employment');
52
+ // Add indexes that exist in database but missing from model
53
+ applicantSelfEmploymentSchema.index({ applicantId: 1 }); // Filter by applicant
52
54
  const ApplicantSelfEmploymentModel = mongoose.model("Applicant_Self_Employment", applicantSelfEmploymentSchema);
53
55
  export default ApplicantSelfEmploymentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-sole-trader-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-sole-trader-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAsB5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyE,CAAC;AAE9G,eAAe,8BAA8B,CAAC"}
1
+ {"version":3,"file":"applicant-sole-trader-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-sole-trader-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAwB5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyE,CAAC;AAE9G,eAAe,8BAA8B,CAAC"}
@@ -16,5 +16,6 @@ soleTraderIncomeSchema.virtual('incomeSourceId').get(function () {
16
16
  });
17
17
  // Apply workflow plugin to the schema
18
18
  applyWorkflowPlugin(soleTraderIncomeSchema, 'applicant_sole_trader_income');
19
+ soleTraderIncomeSchema.index({ applicantId: 1 });
19
20
  const ApplicantSoleTraderIncomeModel = mongoose.model("Applicant_Sole_Trader_Income", soleTraderIncomeSchema);
20
21
  export default ApplicantSoleTraderIncomeModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-uk-tax-credits.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-uk-tax-credits.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAoB5D,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0E,CAAC;AAE3G,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"applicant-uk-tax-credits.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-uk-tax-credits.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAuB5D,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0E,CAAC;AAE3G,eAAe,0BAA0B,CAAC"}
@@ -15,5 +15,7 @@ applicantUkTaxCreditsSchema.virtual('incomeSourceId').get(function () {
15
15
  });
16
16
  // Apply workflow plugin to the schema
17
17
  applyWorkflowPlugin(applicantUkTaxCreditsSchema, 'applicant_uk_tax_credits');
18
+ // Add indexes that exist in database but missing from model
19
+ applicantUkTaxCreditsSchema.index({ applicantId: 1 }); // Filter by applicant
18
20
  const ApplicantUkTaxCreditsModel = mongoose.model("Applicant_Uk_Tax_Credits", applicantUkTaxCreditsSchema);
19
21
  export default ApplicantUkTaxCreditsModel;
@@ -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;AAqtBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,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"}
@@ -288,12 +288,6 @@ welcomeCallSchema.virtual('applicantEmployerBusinessName').get(function () {
288
288
  console.log('No employment status found');
289
289
  }
290
290
  }
291
- else {
292
- console.log('No income settings found');
293
- }
294
- }
295
- else {
296
- console.log('No applicant found');
297
291
  }
298
292
  return 'N/A';
299
293
  });
@@ -314,143 +308,46 @@ welcomeCallSchema.virtual('customerContactNumbers').get(function () {
314
308
  }
315
309
  return null;
316
310
  });
317
- // Virtual property for all applicants name/DOB when there are multiple applicants
318
- welcomeCallSchema.virtual('allApplicantsNameAndDOB').get(function () {
319
- // Get application and its applicants
320
- if (this.applicationId && typeof this.applicationId === 'object') {
321
- const application = this.applicationId;
322
- // Get all applicants from the application (field name is 'applicants')
323
- if (application.applicants && Array.isArray(application.applicants) && application.applicants.length > 0) {
324
- // Get current applicant ID for comparison
325
- const currentApplicantId = this.applicantId?._id || this.applicantId;
326
- // Filter out the current applicant to get only OTHER applicants
327
- const otherApplicants = application.applicants.filter((applicant) => {
328
- const applicantId = applicant._id || applicant;
329
- return applicantId.toString() !== currentApplicantId.toString();
330
- });
331
- // If no other applicants, return "N/A" (single applicant case)
332
- if (otherApplicants.length === 0) {
333
- return 'N/A';
334
- }
335
- // Format each other applicant as: firstName,middleName,lastName,dd/mm/yyyy
336
- const formattedApplicants = otherApplicants.map((applicant) => {
337
- // Check if applicant is an ObjectId (not populated)
338
- if (typeof applicant === 'string' || (applicant.constructor && applicant.constructor.name === 'ObjectId')) {
339
- return null; // Skip unpopulated references
340
- }
341
- const firstName = applicant.firstName || '';
342
- const middleName = applicant.middleName || '';
343
- const lastName = applicant.lastName || '';
344
- // Combine first and middle names
345
- const fullFirstName = middleName ? `${firstName},${middleName}` : firstName;
346
- // Format date of birth to dd/mm/yyyy
347
- let formattedDOB = '';
348
- if (applicant.dateOfBirth) {
349
- // Check if dateOfBirth is already a formatted string (DD/MM/YYYY)
350
- if (typeof applicant.dateOfBirth === 'string' && /^\d{2}\/\d{2}\/\d{4}$/.test(applicant.dateOfBirth)) {
351
- // Already in DD/MM/YYYY format
352
- formattedDOB = applicant.dateOfBirth;
353
- }
354
- else {
355
- // Try to parse as Date object or ISO string
356
- try {
357
- const date = new Date(applicant.dateOfBirth);
358
- // Check if date is valid
359
- if (!isNaN(date.getTime())) {
360
- const day = String(date.getDate()).padStart(2, '0');
361
- const month = String(date.getMonth() + 1).padStart(2, '0');
362
- const year = date.getFullYear();
363
- formattedDOB = `${day}/${month}/${year}`;
364
- }
365
- }
366
- catch (e) {
367
- // Date parsing failed, try to use as-is if it's a string
368
- if (typeof applicant.dateOfBirth === 'string') {
369
- formattedDOB = applicant.dateOfBirth;
370
- }
371
- }
372
- }
373
- }
374
- return `${fullFirstName},${lastName},${formattedDOB}`;
375
- }).filter((line) => line && line.trim() !== ',,' && line.trim() !== '');
376
- // Join all applicants with newline
377
- return formattedApplicants.join('\n');
378
- }
379
- }
380
- // If application not populated or no applicants, return "N/A"
381
- return 'N/A';
382
- });
383
311
  // Virtual property for other applicants name and DOB in the requested format
384
312
  welcomeCallSchema.virtual('otherApplicantsNameAndDOB').get(function () {
385
- console.log('=== DEBUG otherApplicantsNameAndDOB ===');
386
- console.log('this.applicationId:', this.applicationId);
387
- console.log('this.applicantId:', this.applicantId);
388
- console.log('typeof this.applicationId:', typeof this.applicationId);
389
- console.log('typeof this.applicantId:', typeof this.applicantId);
390
- // Try to get application from applicantId first, then from applicationId
391
313
  let application = null;
392
- if (this.applicantId &&
393
- typeof this.applicantId === 'object' &&
394
- !(typeof this.applicantId.toHexString === 'function') && // not ObjectId
395
- this.applicantId.applicationId) {
314
+ if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
396
315
  application = this.applicantId.applicationId;
397
- console.log('Got application from applicantId.applicationId');
398
316
  }
399
317
  else if (this.applicationId && typeof this.applicationId === 'object') {
400
318
  application = this.applicationId;
401
- console.log('Got application from this.applicationId');
402
319
  }
403
320
  else {
404
- console.log('No application found in either applicantId.applicationId or this.applicationId');
405
321
  return 'N/A';
406
322
  }
407
323
  if (application) {
408
- console.log('application object:', application);
409
- console.log('application.applicants:', application.applicants);
410
- console.log('Array.isArray(application.applicants):', Array.isArray(application.applicants));
411
- console.log('application.applicants.length:', application.applicants?.length);
412
- // Additional debug: Check if applicants is populated
413
- if (application.applicants && application.applicants.length > 0) {
414
- console.log('First applicant sample:', application.applicants[0]);
415
- console.log('First applicant type:', typeof application.applicants[0]);
416
- console.log('First applicant has firstName:', !!application.applicants[0]?.firstName);
417
- }
418
324
  // Get all applicants from the application (field name is 'applicants')
419
325
  if (application.applicants && Array.isArray(application.applicants) && application.applicants.length > 0) {
420
- console.log('Found applicants array with length:', application.applicants.length);
421
326
  // Get current applicant ID for comparison
422
327
  const currentApplicantId = this.applicantId?._id || this.applicantId;
423
- console.log('currentApplicantId:', currentApplicantId);
424
328
  // Filter out the current applicant to get only OTHER applicants
425
329
  const otherApplicants = application.applicants.filter((applicant) => {
426
330
  const applicantId = applicant._id || applicant;
427
- console.log('Comparing applicantId:', applicantId, 'with currentApplicantId:', currentApplicantId);
428
331
  return applicantId.toString() !== currentApplicantId.toString();
429
332
  });
430
- console.log('otherApplicants after filtering:', otherApplicants.length);
431
333
  // If no other applicants, return "N/A" (single applicant case)
432
334
  if (otherApplicants.length === 0) {
433
- console.log('No other applicants found, returning N/A');
434
335
  return 'N/A';
435
336
  }
436
337
  // Format each other applicant as: "First and middle names, last name, Date of birth"
437
338
  const formattedApplicants = otherApplicants.map((applicant) => {
438
- console.log('Processing applicant:', applicant);
439
339
  // Check if applicant is an ObjectId (not populated)
440
340
  if (typeof applicant === 'string' || (applicant.constructor && applicant.constructor.name === 'ObjectId')) {
441
- console.log('Applicant is not populated, skipping');
442
341
  return null; // Skip unpopulated references
443
342
  }
444
343
  const firstName = applicant.firstName || '';
445
344
  const middleName = applicant.middleName || '';
446
345
  const lastName = applicant.lastName || '';
447
- console.log('Applicant names:', { firstName, middleName, lastName });
448
346
  // Combine first and middle names with space
449
347
  const fullFirstName = middleName ? `${firstName} ${middleName}` : firstName;
450
348
  // Format date of birth to dd/mm/yyyy
451
349
  let formattedDOB = '';
452
350
  if (applicant.dateOfBirth) {
453
- console.log('Applicant dateOfBirth:', applicant.dateOfBirth);
454
351
  // Check if dateOfBirth is already a formatted string (DD/MM/YYYY)
455
352
  if (typeof applicant.dateOfBirth === 'string' && /^\d{2}\/\d{2}\/\d{4}$/.test(applicant.dateOfBirth)) {
456
353
  // Already in DD/MM/YYYY format
@@ -477,24 +374,13 @@ welcomeCallSchema.virtual('otherApplicantsNameAndDOB').get(function () {
477
374
  }
478
375
  }
479
376
  // Format as "First and middle names, last name, Date of birth"
480
- const result = `${fullFirstName}, ${lastName}, ${formattedDOB}`;
481
- console.log('Formatted applicant result:', result);
482
- return result;
377
+ return `${fullFirstName}, ${lastName}, ${formattedDOB}`;
483
378
  }).filter((line) => line && line.trim() !== ', ,' && line.trim() !== '');
484
- console.log('Final formattedApplicants:', formattedApplicants);
485
379
  // Join all applicants with newline
486
- const finalResult = formattedApplicants.join('\n');
487
- console.log('Final result:', finalResult);
488
- return finalResult;
489
- }
490
- else {
491
- console.log('No applicants array found or empty array');
492
- console.log('This means you need to populate the applicationId with applicants when querying');
493
- console.log('Use: .populate({ path: "applicationId", populate: { path: "applicants" } })');
380
+ return formattedApplicants.join('\n');
494
381
  }
495
382
  }
496
383
  // If application not populated or no applicants, return "N/A"
497
- console.log('Returning N/A - no application or applicants found');
498
384
  return 'N/A';
499
385
  });
500
386
  // Virtual property for broker name and firm
@@ -670,5 +556,7 @@ welcomeCallSchema.virtual('initialRatePercentage').get(function () {
670
556
  applyAuditMiddleware(welcomeCallSchema, "ApplicantWelcomeCall");
671
557
  // Apply workflow plugin to the schema
672
558
  applyWorkflowPlugin(welcomeCallSchema, 'applicantwelcomecall');
559
+ // Index for query optimization
560
+ welcomeCallSchema.index({ applicantId: 1, isActive: 1 }); // Compound index for getWelcomeCallByApplicantId and softDeleteByApplicantId queries
673
561
  const WelcomeCallModel = mongoose.model('ApplicantWelcomeCall', welcomeCallSchema);
674
562
  export default WelcomeCallModel;
@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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACpE,eAAe,cAAc,CAAC"}
@@ -236,5 +236,19 @@ applicantSchema.virtual('numberOfApplicants').get(function () {
236
236
  applyAuditMiddleware(applicantSchema, "Applicant");
237
237
  // Apply workflow plugin to the schema
238
238
  applyWorkflowPlugin(applicantSchema, 'applicant');
239
+ // Database indexes for performance optimization
240
+ // Single field indexes
241
+ applicantSchema.index({ applicationId: 1 });
242
+ applicantSchema.index({ applicantId: 1 });
243
+ // Compound indexes
244
+ applicantSchema.index({ applicationId: 1, isExpenseOwner: 1 }); // For expense owner queries
245
+ applicantSchema.index({ applicationId: 1, _id: 1 }); // For application-scoped queries
246
+ // Indexes for lookup operations
247
+ applicantSchema.index({ nationalityLid: 1 });
248
+ applicantSchema.index({ countryOfResidenceLid: 1 });
249
+ applicantSchema.index({ maritalStatusLid: 1 });
250
+ applicantSchema.index({ residentialStatusLid: 1 });
251
+ applicantSchema.index({ addressCountryLid: 1 });
252
+ applicantSchema.index({ incomeSummaryId: 1 });
239
253
  const ApplicantModel = mongoose.model("Applicant", applicantSchema);
240
254
  export default ApplicantModel;
@@ -90,6 +90,8 @@ const virtualApplicants = applicationDirectDebitSchema.virtual('applicants', {
90
90
  }
91
91
  });
92
92
  virtualApplicants.description = 'Full Name of the applicant';
93
+ // Index for applicationId queries
94
+ applicationDirectDebitSchema.index({ applicationId: 1 });
93
95
  // Apply workflow plugin to the schema
94
96
  applyWorkflowPlugin(applicationDirectDebitSchema, 'application_directdebit');
95
97
  const ApplicationDirectDebitModel = mongoose.model("Application_DirectDebit", applicationDirectDebitSchema);
@@ -1 +1 @@
1
- {"version":3,"file":"application-euc.model.d.ts","sourceRoot":"","sources":["../../applications/application-euc.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAiBhC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyD,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"application-euc.model.d.ts","sourceRoot":"","sources":["../../applications/application-euc.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoBhC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyD,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
@@ -8,5 +8,7 @@ const applicationEucSchema = new mongoose.Schema({
8
8
  });
9
9
  // Apply workflow plugin to the schema
10
10
  applyWorkflowPlugin(applicationEucSchema, 'applicationeuc');
11
+ // Add indexes that exist in database but missing from model
12
+ applicationEucSchema.index({ applicationId: 1 }, { unique: true }); // Unique index for applicationId
11
13
  const ApplicationEucModel = mongoose.model("ApplicationEUC", applicationEucSchema);
12
14
  export default ApplicationEucModel;
@@ -262,5 +262,7 @@ mortgageSchema.virtual("sourceOfWealth").get(function () {
262
262
  });
263
263
  // Apply workflow plugin to the schema
264
264
  applyWorkflowPlugin(mortgageSchema, 'mortgage');
265
+ // Index for query optimization
266
+ mortgageSchema.index({ applicationId: 1 }); // Index for getByApplicationId queries
265
267
  const MortgageModel = mongoose.model("Mortgage", mortgageSchema);
266
268
  export default MortgageModel;
@@ -1 +1 @@
1
- {"version":3,"file":"application-note.model.d.ts","sourceRoot":"","sources":["../../applications/application-note.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA6FhC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACzE,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"application-note.model.d.ts","sourceRoot":"","sources":["../../applications/application-note.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAiHhC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACzE,eAAe,mBAAmB,CAAC"}
@@ -83,5 +83,23 @@ const noteSchema = new mongoose.Schema({
83
83
  });
84
84
  // Apply workflow plugin to the schema
85
85
  applyWorkflowPlugin(noteSchema, 'applictionnote');
86
+ // Database indexes for performance optimization
87
+ // Existing indexes
88
+ noteSchema.index({ applicationId: 1 });
89
+ noteSchema.index({ noteId: 1 });
90
+ noteSchema.index({ createdByUserId: 1 });
91
+ noteSchema.index({ noteTypeLid: 1 });
92
+ noteSchema.index({ noteSubTypeLid: 1 });
93
+ noteSchema.index({
94
+ applicationId: 1,
95
+ noteId: 1
96
+ });
97
+ // Additional recommended indexes for query patterns
98
+ // Compound indexes for primary query patterns
99
+ noteSchema.index({ applicationId: 1, createdOn: -1 }); // Primary query pattern with sort
100
+ noteSchema.index({ applicationId: 1, noteTypeLid: 1 }); // For filtering by type
101
+ noteSchema.index({ applicationId: 1, createdBy: 1 }); // For filtering by creator
102
+ // Single field indexes for distinct and filter operations
103
+ noteSchema.index({ createdBy: 1 }); // For distinct operations and creator filtering
86
104
  const ApplictionNoteModel = mongoose.model("ApplictionNote", noteSchema);
87
105
  export default ApplictionNoteModel;
@@ -1 +1 @@
1
- {"version":3,"file":"application-product.model.d.ts","sourceRoot":"","sources":["../../applications/application-product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA4FhC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2C,CAAC;AAC9D,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"application-product.model.d.ts","sourceRoot":"","sources":["../../applications/application-product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA6FhC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2C,CAAC;AAC9D,eAAe,YAAY,CAAC"}
@@ -77,5 +77,8 @@ productSchema.virtual('productFeePaymentType').get(function () {
77
77
  });
78
78
  // Apply workflow plugin to the schema
79
79
  applyWorkflowPlugin(productSchema, 'product');
80
+ // Indexes for query optimization
81
+ productSchema.index({ applicationId: 1 }); // Index for updateByApplicationId and getByApplicationIdWithRepaymentType queries
82
+ productSchema.index({ repaymentTypeLid: 1 }); // Index for populate operations on repaymentTypeLid
80
83
  const ProductModel = mongoose.model("Product", productSchema);
81
84
  export default ProductModel;
@@ -1 +1 @@
1
- {"version":3,"file":"application.model.d.ts","sourceRoot":"","sources":["../../applications/application.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAwOhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAC;AAC1E,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"application.model.d.ts","sourceRoot":"","sources":["../../applications/application.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAsPhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAC;AAC1E,eAAe,gBAAgB,CAAC"}
@@ -206,5 +206,16 @@ applicationSchema.virtual('taskCompletionPercent').get(function () {
206
206
  // Calculate (lender/total)*100
207
207
  return Number(((lender / total) * 100).toFixed(2));
208
208
  });
209
+ // Database indexes for performance optimization
210
+ // Single field indexes
211
+ applicationSchema.index({ applicationId: 1 });
212
+ applicationSchema.index({ assignedToUserId: 1 });
213
+ applicationSchema.index({ brokerId: 1 });
214
+ applicationSchema.index({ applicants: 1 }); // For array membership queries
215
+ // Compound indexes for common query combinations
216
+ applicationSchema.index({ applicants: 1, _id: 1 }); // For finding application by applicant
217
+ applicationSchema.index({ assignedToUserId: 1, statusLid: 1 }); // For filtering by assignee and status
218
+ // Text index for search functionality
219
+ applicationSchema.index({ applicationNumber: "text" });
209
220
  const ApplicationModel = mongoose.model("Application", applicationSchema);
210
221
  export default ApplicationModel;
@@ -1 +1 @@
1
- {"version":3,"file":"applications-task.model.d.ts","sourceRoot":"","sources":["../../applications/applications-task.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA4ChC,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6D,CAAC;AACzF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"applications-task.model.d.ts","sourceRoot":"","sources":["../../applications/applications-task.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA+ChC,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6D,CAAC;AACzF,eAAe,qBAAqB,CAAC"}
@@ -38,5 +38,8 @@ const applicationsTaskSchema = new mongoose.Schema({
38
38
  applyAuditMiddleware(applicationsTaskSchema, "ApplicationsTask");
39
39
  // Apply workflow plugin to the schema
40
40
  applyWorkflowPlugin(applicationsTaskSchema, 'applicationstask');
41
+ // Indexes for query optimization
42
+ applicationsTaskSchema.index({ applicationId: 1, instanceId: 1 }); // Compound index for findByApplicationIdAndInstanceId queries
43
+ applicationsTaskSchema.index({ applicationId: 1, createdOn: -1 }); // Compound index for findAll with sort by createdOn descending
41
44
  const ApplicationsTaskModel = mongoose.model("ApplicationsTask", applicationsTaskSchema);
42
45
  export default ApplicationsTaskModel;
@@ -1 +1 @@
1
- {"version":3,"file":"product-catalogue.model.d.ts","sourceRoot":"","sources":["../../product-catalogues/product-catalogue.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAuBhC,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6D,CAAC;AACzF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"product-catalogue.model.d.ts","sourceRoot":"","sources":["../../product-catalogues/product-catalogue.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAyBhC,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6D,CAAC;AACzF,eAAe,qBAAqB,CAAC"}
@@ -17,5 +17,6 @@ const productCatalogueSchema = new mongoose.Schema({
17
17
  });
18
18
  // Apply workflow plugin to the schema
19
19
  applyWorkflowPlugin(productCatalogueSchema, 'productcatalogue');
20
+ productCatalogueSchema.index({ productCatalogueId: 1 });
20
21
  const ProductCatalogueModel = mongoose.model('ProductCatalogue', productCatalogueSchema);
21
22
  export default ProductCatalogueModel;
@@ -1 +1 @@
1
- {"version":3,"file":"product-variant.model.d.ts","sourceRoot":"","sources":["../../product-catalogues/product-variant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAkBhC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyD,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"product-variant.model.d.ts","sourceRoot":"","sources":["../../product-catalogues/product-variant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoBhC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyD,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
@@ -9,6 +9,7 @@ const productVariantSchema = new mongoose.Schema({
9
9
  }, {
10
10
  timestamps: true
11
11
  });
12
+ productVariantSchema.index({ productCatalogueId: 1, variantid: 1 });
12
13
  // Apply workflow plugin to the schema
13
14
  applyWorkflowPlugin(productVariantSchema, 'productvariant');
14
15
  const ProductVariantModel = mongoose.model('ProductVariant', productVariantSchema);
@@ -1 +1 @@
1
- {"version":3,"file":"security.model.d.ts","sourceRoot":"","sources":["../../properties/security.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAiKhC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACjE,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"security.model.d.ts","sourceRoot":"","sources":["../../properties/security.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAsKhC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACjE,eAAe,aAAa,CAAC"}
@@ -145,5 +145,9 @@ securitySchema.virtual('lendingType').get(function () {
145
145
  });
146
146
  // Apply workflow plugin to the schema
147
147
  applyWorkflowPlugin(securitySchema, 'security');
148
+ // Indexes for query optimization
149
+ securitySchema.index({ applicationId: 1 });
150
+ securitySchema.index({ propertyTypeLid: 1 });
151
+ securitySchema.index({ propertyTenureLid: 1 });
148
152
  const SecurityModel = mongoose.model("Security", securitySchema);
149
153
  export default SecurityModel;
@@ -40,6 +40,7 @@ declare const ApiLogModel: mongoose.Model<{
40
40
  statusCode: number;
41
41
  loggedAt: NativeDate;
42
42
  stackTrace: string[];
43
+ status?: string | null | undefined;
43
44
  errorMessage?: string | null | undefined;
44
45
  requestData?: any;
45
46
  responseData?: any;
@@ -52,6 +53,7 @@ declare const ApiLogModel: mongoose.Model<{
52
53
  statusCode: number;
53
54
  loggedAt: NativeDate;
54
55
  stackTrace: string[];
56
+ status?: string | null | undefined;
55
57
  errorMessage?: string | null | undefined;
56
58
  requestData?: any;
57
59
  responseData?: any;
@@ -64,6 +66,7 @@ declare const ApiLogModel: mongoose.Model<{
64
66
  statusCode: number;
65
67
  loggedAt: NativeDate;
66
68
  stackTrace: string[];
69
+ status?: string | null | undefined;
67
70
  errorMessage?: string | null | undefined;
68
71
  requestData?: any;
69
72
  responseData?: any;
@@ -82,6 +85,7 @@ declare const ApiLogModel: mongoose.Model<{
82
85
  statusCode: number;
83
86
  loggedAt: NativeDate;
84
87
  stackTrace: string[];
88
+ status?: string | null | undefined;
85
89
  errorMessage?: string | null | undefined;
86
90
  requestData?: any;
87
91
  responseData?: any;
@@ -94,6 +98,7 @@ declare const ApiLogModel: mongoose.Model<{
94
98
  statusCode: number;
95
99
  loggedAt: NativeDate;
96
100
  stackTrace: string[];
101
+ status?: string | null | undefined;
97
102
  errorMessage?: string | null | undefined;
98
103
  requestData?: any;
99
104
  responseData?: any;
@@ -106,6 +111,7 @@ declare const ApiLogModel: mongoose.Model<{
106
111
  statusCode: number;
107
112
  loggedAt: NativeDate;
108
113
  stackTrace: string[];
114
+ status?: string | null | undefined;
109
115
  errorMessage?: string | null | undefined;
110
116
  requestData?: any;
111
117
  responseData?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"api-log.model.d.ts","sourceRoot":"","sources":["../../shared/api-log.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoBhC;;;GAGG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0C,CAAC;AAE5D,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"api-log.model.d.ts","sourceRoot":"","sources":["../../shared/api-log.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAyBhC;;;GAGG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0C,CAAC;AAE5D,eAAe,WAAW,CAAC"}
@@ -7,12 +7,16 @@ const apiLogSchema = new mongoose.Schema({
7
7
  route: { type: String, required: true },
8
8
  createdByUserId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true, },
9
9
  statusCode: { type: Number, required: true },
10
+ status: { type: String }, // For future filtering by status
10
11
  errorMessage: { type: String },
11
12
  loggedAt: { type: Date, default: Date.now },
12
13
  stackTrace: [{ type: String }],
13
14
  requestData: { type: mongoose.Schema.Types.Mixed }, // to store request payload
14
15
  responseData: { type: mongoose.Schema.Types.Mixed }, // to store response payload
15
16
  }, { timestamps: true });
17
+ // Indexes for date and status filtering
18
+ apiLogSchema.index({ createdAt: -1 }); // For date-based queries (newest first)
19
+ apiLogSchema.index({ status: 1, createdAt: -1 }); // Compound index for status + date queries
16
20
  /**
17
21
  * Mongoose model for API logs.
18
22
  * @constant {Model}
@@ -1 +1 @@
1
- {"version":3,"file":"apprivo-sync-journey.model.d.ts","sourceRoot":"","sources":["../../shared/apprivo-sync-journey.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAiBhC,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiE,CAAC;AAC/F,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"apprivo-sync-journey.model.d.ts","sourceRoot":"","sources":["../../shared/apprivo-sync-journey.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoBhC,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiE,CAAC;AAC/F,eAAe,uBAAuB,CAAC"}
@@ -13,5 +13,7 @@ const ApprivoSyncJourneySchema = new mongoose.Schema({
13
13
  startTime: { type: Date, default: null },
14
14
  endTime: { type: Date, default: null },
15
15
  }, { timestamps: true });
16
+ // Add indexes that exist in database but missing from model
17
+ ApprivoSyncJourneySchema.index({ milestoneLid: 1, applicationId: 1 }); // Compound: milestone + application
16
18
  const ApprivoSyncJourneyModel = mongoose.model('ApprivoSyncJourney', ApprivoSyncJourneySchema);
17
19
  export default ApprivoSyncJourneyModel;
@@ -1 +1 @@
1
- {"version":3,"file":"checklist.model.d.ts","sourceRoot":"","sources":["../../shared/checklist.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAiChC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AAEpE,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"checklist.model.d.ts","sourceRoot":"","sources":["../../shared/checklist.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAuChC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AAEpE,eAAe,cAAc,CAAC"}
@@ -26,5 +26,10 @@ const checklistSchema = new mongoose.Schema({
26
26
  }
27
27
  }, { timestamps: true });
28
28
  checklistSchema.index({ checkDescription: 'text', source: 'text' });
29
+ // Add recommended indexes for query optimization
30
+ checklistSchema.index({ applicationId: 1 }); // Filter by application
31
+ checklistSchema.index({ checkTypeLid: 1 }); // Filter by check type
32
+ checklistSchema.index({ checkStatusLid: 1 }); // Filter by check status
33
+ checklistSchema.index({ sourceId: 1 }); // Filter by source (applicant/property/application)
29
34
  const CheckListModel = mongoose.model("CheckList", checklistSchema);
30
35
  export default CheckListModel;
@@ -1 +1 @@
1
- {"version":3,"file":"lookup-group.model.d.ts","sourceRoot":"","sources":["../../shared/lookup-group.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAC;AAC1E,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"lookup-group.model.d.ts","sourceRoot":"","sources":["../../shared/lookup-group.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAwBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAC;AAC1E,eAAe,gBAAgB,CAAC"}
@@ -15,5 +15,8 @@ const lookupGroupSchema = new mongoose.Schema({
15
15
  });
16
16
  // Apply workflow plugin to the schema
17
17
  applyWorkflowPlugin(lookupGroupSchema, 'lookupgroup');
18
+ // Database indexes for performance optimization
19
+ // Single field indexes
20
+ lookupGroupSchema.index({ name: 1 }, { unique: true });
18
21
  const LookupGroupModel = mongoose.model('LookupGroup', lookupGroupSchema);
19
22
  export default LookupGroupModel;
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.model.d.ts","sourceRoot":"","sources":["../../shared/lookup.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAqBhC,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyC,CAAC;AAC3D,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"lookup.model.d.ts","sourceRoot":"","sources":["../../shared/lookup.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA+BhC,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyC,CAAC;AAC3D,eAAe,WAAW,CAAC"}
@@ -16,5 +16,11 @@ const lookupSchema = new mongoose.Schema({
16
16
  type: String
17
17
  }
18
18
  });
19
+ lookupSchema.index({ lookupGroupId: 1 });
20
+ lookupSchema.index({ value: 1 });
21
+ // Case-insensitive index for name queries
22
+ lookupSchema.index({ name: 1 }, { collation: { locale: "en", strength: 2 } });
23
+ // Compound index for lookupGroupId + name queries
24
+ lookupSchema.index({ lookupGroupId: 1, name: 1 }, { collation: { locale: "en", strength: 2 } });
19
25
  const LookupModel = mongoose.model('Lookup', lookupSchema);
20
26
  export default LookupModel;
@@ -1 +1 @@
1
- {"version":3,"file":"webhook-event.model.d.ts","sourceRoot":"","sources":["../../shared/webhook-event.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,aAAa,MAAM,sBAAsB,CAAC;;;;;;AAuDjD,wBAAiF"}
1
+ {"version":3,"file":"webhook-event.model.d.ts","sourceRoot":"","sources":["../../shared/webhook-event.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,aAAa,MAAM,sBAAsB,CAAC;;;;;;AA4DjD,wBAAiF"}
@@ -50,4 +50,8 @@ const webhookEventSchema = new Schema({
50
50
  // Index for efficient querying
51
51
  webhookEventSchema.index({ createdAt: -1 });
52
52
  webhookEventSchema.index({ status: 1, retryCount: 1 });
53
+ // Recommended compound indexes for webhook event queries
54
+ webhookEventSchema.index({ status: 1, createdAt: 1 }); // For findByStatus() with sort
55
+ webhookEventSchema.index({ status: 1, retryCount: 1, createdAt: 1 }); // Enhanced pending events query
56
+ webhookEventSchema.index({ applicationId: 1, createdAt: -1 }); // For findByApplicationId() with sort
53
57
  export default mongoose.model('WebhookEvent', webhookEventSchema);
@@ -1 +1 @@
1
- {"version":3,"file":"auth-log.model.d.ts","sourceRoot":"","sources":["../../users/auth-log.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAqBhC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2C,CAAC;AAE9D,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"auth-log.model.d.ts","sourceRoot":"","sources":["../../users/auth-log.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAyBhC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2C,CAAC;AAE9D,eAAe,YAAY,CAAC"}
@@ -17,5 +17,8 @@ const AuthLogSchema = new mongoose.Schema({
17
17
  enum: ["LOGIN", "LOGOUT", "PASSWORD_RESET"]
18
18
  }
19
19
  });
20
+ // Indexes for query optimization
21
+ AuthLogSchema.index({ userEmail: 1, loggedInTimestamp: -1 }); // Compound index for getByEmail queries with timestamp sort
22
+ AuthLogSchema.index({ loggedInTimestamp: -1 }); // Index for getAll queries sorted by timestamp descending
20
23
  const AuthLogModel = mongoose.model("AuthLog", AuthLogSchema);
21
24
  export default AuthLogModel;
@@ -1 +1 @@
1
- {"version":3,"file":"permission.model.d.ts","sourceRoot":"","sources":["../../users/permission.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAWhC,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiD,CAAC;AAEvE,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"permission.model.d.ts","sourceRoot":"","sources":["../../users/permission.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAchC,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiD,CAAC;AAEvE,eAAe,eAAe,CAAC"}
@@ -6,5 +6,7 @@ const permissionSchema = new mongoose.Schema({
6
6
  }, {
7
7
  timestamps: true
8
8
  });
9
+ // Add recommended indexes for query optimization
10
+ permissionSchema.index({ name: 1 }); // Filter by permission name
9
11
  const PermissionModel = mongoose.model('Permission', permissionSchema);
10
12
  export default PermissionModel;
@@ -1 +1 @@
1
- {"version":3,"file":"role-group.model.d.ts","sourceRoot":"","sources":["../../users/role-group.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAehC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACpE,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"role-group.model.d.ts","sourceRoot":"","sources":["../../users/role-group.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAmBhC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACpE,eAAe,cAAc,CAAC"}
@@ -10,5 +10,8 @@ const RoleGroupSchema = new mongoose.Schema({
10
10
  }, {
11
11
  timestamps: true
12
12
  });
13
+ // Indexes for query optimization
14
+ RoleGroupSchema.index({ name: 1 });
15
+ RoleGroupSchema.index({ roles: 1 });
13
16
  const RoleGroupModel = mongoose.model('RoleGroup', RoleGroupSchema);
14
17
  export default RoleGroupModel;
@@ -1 +1 @@
1
- {"version":3,"file":"role.model.d.ts","sourceRoot":"","sources":["../../users/role.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAchC,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqC,CAAC;AAErD,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"role.model.d.ts","sourceRoot":"","sources":["../../users/role.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAkBhC,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqC,CAAC;AAErD,eAAe,SAAS,CAAC"}
@@ -9,5 +9,8 @@ const RoleSchema = new mongoose.Schema({
9
9
  }, {
10
10
  timestamps: true
11
11
  });
12
+ // Add recommended indexes for query optimization
13
+ RoleSchema.index({ name: 1 }); // Filter by role name
14
+ RoleSchema.index({ permissions: 1 }); // Filter by permissions
12
15
  const RoleModel = mongoose.model('Role', RoleSchema);
13
16
  export default RoleModel;
@@ -1 +1 @@
1
- {"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../users/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAgChC,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqC,CAAC;AAErD,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../users/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA6ChC,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqC,CAAC;AAErD,eAAe,SAAS,CAAC"}
@@ -26,5 +26,15 @@ const userSchema = new mongoose.Schema({
26
26
  }, {
27
27
  timestamps: true
28
28
  });
29
+ // Database indexes for performance optimization
30
+ // Single field indexes
31
+ userSchema.index({ accountId: 1 }, { unique: true });
32
+ userSchema.index({ email: 1 });
33
+ userSchema.index({ token: 1 });
34
+ userSchema.index({ groups: 1 }); // For population
35
+ // Text index for name search
36
+ userSchema.index({ fullName: "text" });
37
+ // Regular index for prefix matching (alternative to text search)
38
+ userSchema.index({ fullName: 1 });
29
39
  const UserModel = mongoose.model('User', userSchema);
30
40
  export default UserModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.3.271",
3
+ "version": "2.3.273",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",