@dynamatix/gb-schemas 1.2.30 → 1.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/applications/application-mortgage.model.d.ts.map +1 -1
- package/dist/applications/application-mortgage.model.js +10 -5
- package/dist/properties/property.model.d.ts +6 -0
- package/dist/properties/property.model.d.ts.map +1 -1
- package/dist/properties/property.model.js +18 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-mortgage.model.d.ts","sourceRoot":"","sources":["../../applications/application-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"application-mortgage.model.d.ts","sourceRoot":"","sources":["../../applications/application-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAiR/C,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AAEjE,eAAe,aAAa,CAAC"}
|
|
@@ -221,19 +221,24 @@ const mortgageSchema = new mongoose.Schema({
|
|
|
221
221
|
mortgageSchema.virtual('applicationType').get(function () {
|
|
222
222
|
return this.applicationId?.applicationTypeLid instanceof mongoose.Types.ObjectId
|
|
223
223
|
? null
|
|
224
|
-
: this.applicationId?.applicationTypeLid?.
|
|
224
|
+
: this.applicationId?.applicationTypeLid?.text || null;
|
|
225
225
|
});
|
|
226
226
|
// virtual property 'lendingType'
|
|
227
227
|
mortgageSchema.virtual('lendingType').get(function () {
|
|
228
228
|
return this.applicationId?.lendingTypeLid instanceof mongoose.Types.ObjectId
|
|
229
229
|
? null
|
|
230
|
-
: this.applicationId?.lendingTypeLid?.
|
|
230
|
+
: this.applicationId?.lendingTypeLid?.text || null;
|
|
231
231
|
});
|
|
232
232
|
// virtual property 'lendingType'
|
|
233
233
|
mortgageSchema.virtual('sourceOfWealth').get(function () {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
const sourceOfWealthLids = this.applicationId?.sourceOfWealthLids;
|
|
235
|
+
if (!Array.isArray(sourceOfWealthLids)) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
return sourceOfWealthLids
|
|
239
|
+
.filter((lid) => !(lid instanceof mongoose.Types.ObjectId))
|
|
240
|
+
.map((lid) => lid?.text || null)
|
|
241
|
+
.filter((text) => text !== null);
|
|
237
242
|
});
|
|
238
243
|
const MortgageModel = mongoose.model("Mortgage", mortgageSchema);
|
|
239
244
|
export default MortgageModel;
|
|
@@ -125,6 +125,7 @@ declare const PropertyModel: mongoose.Model<{
|
|
|
125
125
|
toISOString?: {} | null | undefined;
|
|
126
126
|
getVarDate?: {} | null | undefined;
|
|
127
127
|
} | null | undefined;
|
|
128
|
+
pageValidFlag?: unknown;
|
|
128
129
|
addressLine1?: unknown;
|
|
129
130
|
addressLine2?: unknown;
|
|
130
131
|
addressLine3?: unknown;
|
|
@@ -471,6 +472,7 @@ declare const PropertyModel: mongoose.Model<{
|
|
|
471
472
|
toISOString?: {} | null | undefined;
|
|
472
473
|
getVarDate?: {} | null | undefined;
|
|
473
474
|
} | null | undefined;
|
|
475
|
+
pageValidFlag?: unknown;
|
|
474
476
|
addressLine1?: unknown;
|
|
475
477
|
addressLine2?: unknown;
|
|
476
478
|
addressLine3?: unknown;
|
|
@@ -817,6 +819,7 @@ declare const PropertyModel: mongoose.Model<{
|
|
|
817
819
|
toISOString?: {} | null | undefined;
|
|
818
820
|
getVarDate?: {} | null | undefined;
|
|
819
821
|
} | null | undefined;
|
|
822
|
+
pageValidFlag?: unknown;
|
|
820
823
|
addressLine1?: unknown;
|
|
821
824
|
addressLine2?: unknown;
|
|
822
825
|
addressLine3?: unknown;
|
|
@@ -1081,6 +1084,7 @@ declare const PropertyModel: mongoose.Model<{
|
|
|
1081
1084
|
updatedAt: NativeDate;
|
|
1082
1085
|
} & {
|
|
1083
1086
|
applicationId: mongoose.Types.ObjectId;
|
|
1087
|
+
pageValidFlag: boolean;
|
|
1084
1088
|
addressLine1: string;
|
|
1085
1089
|
outstandingBalance: Pound;
|
|
1086
1090
|
remainingTerm: number;
|
|
@@ -1103,6 +1107,7 @@ declare const PropertyModel: mongoose.Model<{
|
|
|
1103
1107
|
updatedAt: NativeDate;
|
|
1104
1108
|
} & {
|
|
1105
1109
|
applicationId: mongoose.Types.ObjectId;
|
|
1110
|
+
pageValidFlag: boolean;
|
|
1106
1111
|
addressLine1: string;
|
|
1107
1112
|
outstandingBalance: Pound;
|
|
1108
1113
|
remainingTerm: number;
|
|
@@ -1125,6 +1130,7 @@ declare const PropertyModel: mongoose.Model<{
|
|
|
1125
1130
|
updatedAt: NativeDate;
|
|
1126
1131
|
} & {
|
|
1127
1132
|
applicationId: mongoose.Types.ObjectId;
|
|
1133
|
+
pageValidFlag: boolean;
|
|
1128
1134
|
addressLine1: string;
|
|
1129
1135
|
outstandingBalance: Pound;
|
|
1130
1136
|
remainingTerm: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.model.d.ts","sourceRoot":"","sources":["../../properties/property.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"property.model.d.ts","sourceRoot":"","sources":["../../properties/property.model.ts"],"names":[],"m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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACjE,eAAe,aAAa,CAAC"}
|
|
@@ -5,6 +5,13 @@ const propertySchema = new mongoose.Schema({
|
|
|
5
5
|
description: "Unique identifier for the application",
|
|
6
6
|
required: true
|
|
7
7
|
},
|
|
8
|
+
pageValidFlag: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: true,
|
|
11
|
+
description: "Flag indicating if the page is valid",
|
|
12
|
+
get: (value) => value ? 'Yes' : 'No',
|
|
13
|
+
set: (value) => value.toLowerCase() === 'yes',
|
|
14
|
+
},
|
|
8
15
|
propertyId: {
|
|
9
16
|
type: String,
|
|
10
17
|
required: true,
|
|
@@ -110,13 +117,17 @@ const propertySchema = new mongoose.Schema({
|
|
|
110
117
|
toJSON: { virtuals: true },
|
|
111
118
|
toObject: { virtuals: true }
|
|
112
119
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
propertySchema.virtual('country').get(function () {
|
|
121
|
+
return this.countryLid instanceof mongoose.Types.ObjectId ? null : this.countryLid?.name || null;
|
|
122
|
+
});
|
|
123
|
+
propertySchema.virtual('stressedRCR').get(function () {
|
|
124
|
+
const monthlyRentValue = parseFloat((this.monthlyRent?.toString()).replace('£', '').replace(',', ''));
|
|
125
|
+
const monthlyRepaymentValue = parseFloat((this.monthlyRepayment?.toString()).replace('£', '').replace(',', ''));
|
|
126
|
+
if (monthlyRepaymentValue === 0) {
|
|
127
|
+
return 0; // Avoid division by zero
|
|
128
|
+
}
|
|
129
|
+
const stressedRCR = (monthlyRentValue / monthlyRepaymentValue) * 100;
|
|
130
|
+
return stressedRCR;
|
|
119
131
|
});
|
|
120
|
-
virtualCountry.description = 'Populated lookup value for country';
|
|
121
132
|
const PropertyModel = mongoose.model('Property', propertySchema);
|
|
122
133
|
export default PropertyModel;
|