@dynamatix/gb-schemas 0.8.0 → 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "index.js",
6
6
  "scripts": {