@dynamatix/gb-schemas 0.7.1 → 0.9.0

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.
@@ -100,23 +100,59 @@ const applicantSchema = new mongoose.Schema({
100
100
  incomeSource: applicantIncomeSourceSchema,
101
101
  expenditure: applicantExpenditureSchema,
102
102
  employment: applicantEmploymentSchema,
103
- commitments:[applicantCommitmentSchema],
103
+ commitments: [applicantCommitmentSchema],
104
104
  directDebit: applicantDirectDebitSchema,
105
105
  creditProfile: creditProfileSchema,
106
106
  income: incomeSchema
107
+ }, {
108
+ timestamps: true,
109
+ toJSON: { virtuals: true },
110
+ toObject: { virtuals: true }
107
111
  });
108
112
 
109
113
  applicantSchema.virtual('nationality').get(function () {
110
- return this.nationalityLid ? this.nationalityLid.name : null;
114
+ return this.nationalityLid?.name ?? null;
111
115
  });
112
116
 
113
117
  applicantSchema.virtual('residence').get(function () {
114
- return this.countryOfResidenceLid ? this.countryOfResidenceLid.name : null;
118
+ return this.countryOfResidenceLid?.name ?? null;
115
119
  });
116
120
 
117
121
  applicantSchema.virtual('industry').get(function () {
118
- return this.employment?.industryLid ? this.employment?.industryLid.name : null;
122
+ return this.employment?.industryLid ? this.employment?.industryLid?.name : null;
119
123
  });
120
- applicantSchema.set('toJSON', { virtuals: true });
124
+
125
+ applicantSchema.virtual('addressCountry').get(function () {
126
+ return this.addressCountryLid?.name ?? null;
127
+ });
128
+
129
+ applicantSchema.virtual('previous1AddressCountry').get(function () {
130
+ return this.previous1AddressCountryLid?.name ?? null;
131
+ });
132
+
133
+ applicantSchema.virtual('previous2AddressCountry').get(function () {
134
+ return this.previous2AddressCountryLid?.name ?? null;
135
+ });
136
+
137
+ applicantSchema.virtual('maritalStatus').get(function () {
138
+ return this.maritalStatusLid?.name ?? null;
139
+ });
140
+
141
+ applicantSchema.virtual('relationshipToOthers').get(function () {
142
+ return this.relationshipToOthersLid?.name ?? null;
143
+ });
144
+
145
+ applicantSchema.virtual('residentialStatus').get(function () {
146
+ return this.residentialStatusLid?.name ?? null;
147
+ });
148
+
149
+ applicantSchema.virtual('taxPayer').get(function () {
150
+ return this.taxPayerLid?.name ?? null;
151
+ });
152
+
153
+ applicantSchema.virtual('vulnerabilityType').get(function () {
154
+ return this.VulnerabilityTypeLid?.name ?? null;
155
+ });
156
+
121
157
  const ApplicantModel = mongoose.model("Applicant", applicantSchema);
122
- export default ApplicantModel;
158
+ export default ApplicantModel;
@@ -134,6 +134,16 @@ applicationSchema.virtual('noOfApplicants').get(function() {
134
134
  applicationSchema.virtual('solicitorEmail').get(function() {
135
135
  return this.solicitorId ? this.solicitorId?.email : null;
136
136
  });
137
+
138
+ // Virtual property for broker phone
139
+ applicationSchema.virtual('brokerPhone').get(function () {
140
+ return this.brokerId ? this.brokerId?.mobileTelephone : null;
141
+ });
142
+
143
+ // Virtual property for solicitor phone
144
+ applicationSchema.virtual('solicitorPhone').get(function () {
145
+ return this.solicitorId ? this.solicitorId?.telephone : null;
146
+ });
137
147
 
138
148
  const ApplicationModel = mongoose.model("Application", applicationSchema);
139
149
  export default ApplicationModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "index.js",
6
6
  "scripts": {