@dynamatix/gb-schemas 2.3.292 → 2.3.294

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;AA6sBhC,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;AAwtBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
@@ -572,7 +572,7 @@ welcomeCallSchema.virtual('initialRatePercentage').get(function () {
572
572
  return null;
573
573
  });
574
574
  // Virtual property for finance summary HTML
575
- welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
575
+ welcomeCallSchema.virtual('financeSummaryHtml').get(async function () {
576
576
  let application = null;
577
577
  if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
578
578
  application = this.applicantId.applicationId;
@@ -587,7 +587,7 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
587
587
  // Initialize summary data
588
588
  let product = '';
589
589
  let financeTerm = '';
590
- let monthlyFinance = '';
590
+ let monthlyRepayment = '';
591
591
  let rentalIncome = '';
592
592
  let occupancy = '';
593
593
  // Get product information (first 3 characters)
@@ -624,11 +624,24 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
624
624
  const rentalValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
625
625
  rentalIncome = `£${rentalValue}`;
626
626
  }
627
- // Get finance amount from loanRequired
628
- if (mortgage.loanRequired !== undefined && mortgage.loanRequired !== null) {
629
- const numericValue = Number(mortgage.loanRequired);
630
- const financeValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
631
- monthlyFinance = `£${financeValue}`;
627
+ // Get monthly repayment amount from productFeatures collection
628
+ try {
629
+ const ApplicationProductFeatures = mongoose.model('ApplicationProductFeatures');
630
+ const productFeatures = await ApplicationProductFeatures.findOne({
631
+ applicationId: application
632
+ });
633
+ if (productFeatures && productFeatures.repayment !== undefined && productFeatures.repayment !== null) {
634
+ const numericValue = Number(productFeatures.repayment);
635
+ const repaymentValue = isNaN(numericValue) ? '0.00' : numericValue.toFixed(2);
636
+ monthlyRepayment = `£${repaymentValue}`;
637
+ }
638
+ else {
639
+ monthlyRepayment = '-';
640
+ }
641
+ }
642
+ catch (error) {
643
+ console.log('Error fetching product features:', error);
644
+ monthlyRepayment = '-';
632
645
  }
633
646
  // Get occupancy information from mortgage
634
647
  if (mortgage.proposedTenantsLids && Array.isArray(mortgage.proposedTenantsLids) && mortgage.proposedTenantsLids.length > 0) {
@@ -646,12 +659,12 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
646
659
  const isBTL = application.lendingTypeLid &&
647
660
  typeof application.lendingTypeLid === 'object' &&
648
661
  application.lendingTypeLid.name === 'BTL';
649
- const monthlyFinanceClass = isBTL ? 'mb-2' : '';
662
+ const monthlyRepaymentClass = isBTL ? 'mb-2' : '';
650
663
  // Create HTML content
651
664
  let summaryContent = `
652
- <div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Product:</p> <span class="readonly-data ml-2">${product}</span></div>
653
- <div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Finance Term:</p> <span class="readonly-data ml-2">${financeTerm}</span></div>
654
- <div class="flex align-items-center ${monthlyFinanceClass}"><p class="text-bold m-0 readonly-data">Monthly Finance:</p> <span class="readonly-data ml-2">${monthlyFinance}</span></div>`;
665
+ <div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Product:</p> <span class="readonly-data ml-2">${product}</span></div>
666
+ <div class="flex align-items-center mb-2"><p class="text-bold m-0 readonly-data">Finance Term:</p> <span class="readonly-data ml-2">${financeTerm}</span></div>
667
+ <div class="flex align-items-center ${monthlyRepaymentClass}"><p class="text-bold m-0 readonly-data">Monthly Repayment:</p> <span class="readonly-data ml-2">${monthlyRepayment}</span></div>`;
655
668
  // Only show rental income and occupancy for BTL applications
656
669
  if (isBTL) {
657
670
  summaryContent += `
@@ -28,6 +28,9 @@
28
28
  /// <reference types="mongoose/types/inferrawdoctype" />
29
29
  import mongoose from "mongoose";
30
30
  declare const ApplicationRationaleModel: mongoose.Model<{
31
+ createdAt: NativeDate;
32
+ updatedAt: NativeDate;
33
+ } & {
31
34
  applicationId: mongoose.Types.ObjectId;
32
35
  rationaleTypeLid: mongoose.Types.ObjectId;
33
36
  generatedText: string;
@@ -39,6 +42,9 @@ declare const ApplicationRationaleModel: mongoose.Model<{
39
42
  updatedBy: string;
40
43
  } | null | undefined;
41
44
  }, {}, {}, {}, mongoose.Document<unknown, {}, {
45
+ createdAt: NativeDate;
46
+ updatedAt: NativeDate;
47
+ } & {
42
48
  applicationId: mongoose.Types.ObjectId;
43
49
  rationaleTypeLid: mongoose.Types.ObjectId;
44
50
  generatedText: string;
@@ -50,6 +56,9 @@ declare const ApplicationRationaleModel: mongoose.Model<{
50
56
  updatedBy: string;
51
57
  } | null | undefined;
52
58
  }, {}> & {
59
+ createdAt: NativeDate;
60
+ updatedAt: NativeDate;
61
+ } & {
53
62
  applicationId: mongoose.Types.ObjectId;
54
63
  rationaleTypeLid: mongoose.Types.ObjectId;
55
64
  generatedText: string;
@@ -64,7 +73,12 @@ declare const ApplicationRationaleModel: mongoose.Model<{
64
73
  _id: mongoose.Types.ObjectId;
65
74
  } & {
66
75
  __v: number;
67
- }, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
76
+ }, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
77
+ timestamps: true;
78
+ }, {
79
+ createdAt: NativeDate;
80
+ updatedAt: NativeDate;
81
+ } & {
68
82
  applicationId: mongoose.Types.ObjectId;
69
83
  rationaleTypeLid: mongoose.Types.ObjectId;
70
84
  generatedText: string;
@@ -76,6 +90,9 @@ declare const ApplicationRationaleModel: mongoose.Model<{
76
90
  updatedBy: string;
77
91
  } | null | undefined;
78
92
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
93
+ createdAt: NativeDate;
94
+ updatedAt: NativeDate;
95
+ } & {
79
96
  applicationId: mongoose.Types.ObjectId;
80
97
  rationaleTypeLid: mongoose.Types.ObjectId;
81
98
  generatedText: string;
@@ -87,6 +104,9 @@ declare const ApplicationRationaleModel: mongoose.Model<{
87
104
  updatedBy: string;
88
105
  } | null | undefined;
89
106
  }>, {}> & mongoose.FlatRecord<{
107
+ createdAt: NativeDate;
108
+ updatedAt: NativeDate;
109
+ } & {
90
110
  applicationId: mongoose.Types.ObjectId;
91
111
  rationaleTypeLid: mongoose.Types.ObjectId;
92
112
  generatedText: string;
@@ -1 +1 @@
1
- {"version":3,"file":"application-rationale.model.d.ts","sourceRoot":"","sources":["../../applications/application-rationale.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA0BhC,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0D,CAAC;AAC1F,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"application-rationale.model.d.ts","sourceRoot":"","sources":["../../applications/application-rationale.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA4BhC,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0D,CAAC;AAC1F,eAAe,yBAAyB,CAAC"}
@@ -13,6 +13,8 @@ const rationaleSchema = new mongoose.Schema({
13
13
  generatedText: { type: String, default: null },
14
14
  comment: commentSchema,
15
15
  isConfirmed: { type: Boolean, default: null }
16
+ }, {
17
+ timestamps: true
16
18
  });
17
19
  applyAuditMiddleware(rationaleSchema, "ApplicationRationale");
18
20
  // Apply workflow plugin to the schema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.3.292",
3
+ "version": "2.3.294",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",