@dynamatix/gb-schemas 1.2.28 → 1.2.31

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":"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;AA4Q/C,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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?.name || null;
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?.name || null;
230
+ : this.applicationId?.lendingTypeLid?.text || null;
231
231
  });
232
232
  // virtual property 'lendingType'
233
233
  mortgageSchema.virtual('sourceOfWealth').get(function () {
234
- return this.applicationId?.sourceOfWealthLid instanceof mongoose.Types.ObjectId
235
- ? null
236
- : this.applicationId?.sourceOfWealthLid?.name || null;
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;
@@ -1 +1 @@
1
- {"version":3,"file":"solicitor.model.d.ts","sourceRoot":"","sources":["../../applications/solicitor.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAuHtD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACpE,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"solicitor.model.d.ts","sourceRoot":"","sources":["../../applications/solicitor.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAyHtD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACpE,eAAe,cAAc,CAAC"}
@@ -9,7 +9,9 @@ const solicitorSchema = new Schema({
9
9
  pageValidFlag: {
10
10
  type: Boolean,
11
11
  default: true,
12
- description: "Flag indicating if the page is valid"
12
+ description: "Flag indicating if the page is valid",
13
+ get: (value) => value ? 'Yes' : 'No',
14
+ set: (value) => value.toLowerCase() === 'yes',
13
15
  },
14
16
  accountNumber: {
15
17
  type: 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;AA6H/C,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACjE,eAAe,aAAa,CAAC"}
@@ -110,13 +110,17 @@ const propertySchema = new mongoose.Schema({
110
110
  toJSON: { virtuals: true },
111
111
  toObject: { virtuals: true }
112
112
  });
113
- // Virtual property for countryLid (reference to Lookup collection)
114
- const virtualCountry = propertySchema.virtual('country', {
115
- ref: 'Lookup',
116
- localField: 'countryLid',
117
- foreignField: '_id',
118
- justOne: true,
113
+ propertySchema.virtual('country').get(function () {
114
+ return this.countryLid instanceof mongoose.Types.ObjectId ? null : this.countryLid?.name || null;
115
+ });
116
+ propertySchema.virtual('stressedRCR').get(function () {
117
+ const monthlyRentValue = parseFloat(this.monthlyRent.replace('£', '').replace(',', '') || '0');
118
+ const monthlyRepaymentValue = parseFloat(this.monthlyRepayment.replace('£', '').replace(',', '') || '0');
119
+ if (monthlyRepaymentValue === 0) {
120
+ return 0; // Avoid division by zero
121
+ }
122
+ const stressedRCR = (monthlyRentValue / monthlyRepaymentValue) * 100;
123
+ return stressedRCR;
119
124
  });
120
- virtualCountry.description = 'Populated lookup value for country';
121
125
  const PropertyModel = mongoose.model('Property', propertySchema);
122
126
  export default PropertyModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "1.2.28",
3
+ "version": "1.2.31",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",