@dynamatix/gb-schemas 0.21.6 → 0.21.8

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.
Files changed (36) hide show
  1. package/applicants/applicant-commitment.model.js +1 -1
  2. package/applicants/applicant-credit-data.model.js +1 -1
  3. package/applicants/applicant-direct-debit.model.js +2 -2
  4. package/applicants/applicant-employment.model.js +1 -1
  5. package/applicants/applicant-expenditure.model.js +6 -6
  6. package/applicants/applicant-income-source.model.js +4 -4
  7. package/applicants/applicant-income.model.js +13 -13
  8. package/applicants/applicant-other-income.model.js +8 -8
  9. package/applicants/applicant-risk-narrative.model.js +1 -1
  10. package/applicants/applicant.model.js +28 -28
  11. package/applications/application-audit.model.js +3 -3
  12. package/applications/application-company-model.js +11 -11
  13. package/applications/application-credit-profile.model.js +4 -4
  14. package/applications/application-direct-debit.model.js +2 -2
  15. package/applications/application-document.model.js +4 -4
  16. package/applications/application-fieldconfig.model.js +1 -1
  17. package/applications/application-mortgage.model.js +9 -9
  18. package/applications/application-note.model.js +3 -3
  19. package/applications/application-product.model.js +1 -1
  20. package/applications/application-valuation.model.js +5 -5
  21. package/applications/application.model.js +13 -13
  22. package/applications/broker.model.js +1 -1
  23. package/applications/document.model.js +3 -3
  24. package/applications/productfeatures.model.js +53 -53
  25. package/applications/solicitor.model.js +5 -5
  26. package/package.json +2 -2
  27. package/product-catalogues/product-catalogue.model.js +3 -3
  28. package/product-catalogues/product-definitions.model.js +4 -4
  29. package/properties/property.model.js +31 -31
  30. package/shared/alert.model.js +1 -1
  31. package/shared/apprivo-sync-journey.model.js +1 -1
  32. package/shared/job-setting.model.js +1 -1
  33. package/users/role-group.model.js +1 -1
  34. package/users/role.model.js +1 -1
  35. package/users/user.model.js +2 -2
  36. package/utils/encryption.middleware.js +2 -2
@@ -3,7 +3,7 @@ import mongoose from "mongoose";
3
3
 
4
4
  const applicantCommitmentSchema = new mongoose.Schema({
5
5
  commitmentId: String,
6
- doHaveSharedResponsibility: Boolean,
6
+ doHaveSharedResponsibility: String,
7
7
  lenderName: String,
8
8
  monthlyPayment: String,
9
9
  commitmentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
@@ -7,7 +7,7 @@ const applicantCreditDataSchema = new mongoose.Schema({
7
7
  securedArrears: { type: String },
8
8
  statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
9
9
  unsecuredArrears: { type: String },
10
- valid: { type: Boolean}
10
+ valid: { type: String}
11
11
  });
12
12
 
13
13
  export default applicantCreditDataSchema;
@@ -9,9 +9,9 @@ const applicantDirectDebitSchema = new mongoose.Schema({
9
9
  city: { type: String },
10
10
  contactPostcode: { type: String },
11
11
  institution: { type: String },
12
- isConfirmDeclaration: { type: Boolean, default: false },
12
+ isConfirmDeclaration: { type: String, default: false },
13
13
  nameOfAccountHolder: { type: String },
14
- selectedPaymentDay: { type: Number },
14
+ selectedPaymentDay: { type: String },
15
15
  sortCode: { type: String }
16
16
  }, { timestamps: true });
17
17
 
@@ -24,7 +24,7 @@ const applicantEmploymentSchema = new mongoose.Schema({
24
24
  employerTelephone: { type: String },
25
25
  housingAllowance: { type: String },
26
26
  industryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
27
- isUnderTerminationNotice: { type: Boolean, default: null },
27
+ isUnderTerminationNotice: { type: String, default: null },
28
28
  jobTitle: { type: String },
29
29
  maintenance: { type: String },
30
30
  maternityIncome: { type: String },
@@ -1,12 +1,12 @@
1
1
  import mongoose from "mongoose";
2
2
 
3
3
  const applicantExpenditureSchema = new mongoose.Schema({
4
- childCareForDependents: { type: Number },
5
- insurance: { type: Number },
6
- other: { type: Number },
7
- totalMonthlyExpenditure: { type: Number },
8
- transport: { type: Number },
9
- utilities: { type: Number }
4
+ childCareForDependents: { type: String },
5
+ insurance: { type: String },
6
+ other: { type: String },
7
+ totalMonthlyExpenditure: { type: String },
8
+ transport: { type: String },
9
+ utilities: { type: String }
10
10
  });
11
11
 
12
12
  export default applicantExpenditureSchema;
@@ -2,10 +2,10 @@ import mongoose from "mongoose";
2
2
 
3
3
  const applicantIncomeSourceSchema = new mongoose.Schema({
4
4
  employmentStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
5
- incomeFromEmployment: { type: Boolean },
6
- incomeFromPension: { type: Boolean },
7
- incomeFromProperty: { type: Boolean },
8
- incomeFromSavings: { type: Boolean }
5
+ incomeFromEmployment: { type: String },
6
+ incomeFromPension: { type: String },
7
+ incomeFromProperty: { type: String },
8
+ incomeFromSavings: { type: String }
9
9
  });
10
10
 
11
11
  export default applicantIncomeSourceSchema;
@@ -22,15 +22,15 @@ const incomeSchema = new mongoose.Schema({
22
22
  contactName: { type: String, default: '' },
23
23
  currentYearEnd: { type: Date, default: null },
24
24
  dateEstablished: { type: Date, default: null },
25
- doYouHaveAccountant: { type: Boolean, default: false },
26
- isBusinessAddressDifferent: { type: Boolean, default: false },
25
+ doYouHaveAccountant: { type: String, default: false },
26
+ isBusinessAddressDifferent: { type: String, default: false },
27
27
  nameOfBusiness: { type: String, default: '' },
28
28
  natureOfBusiness: { type: String, default: '' },
29
- netAssets1: { type: Number, default: 0.0 },
30
- netAssets2: { type: Number, default: 0.0 },
31
- netAssets3: { type: Number, default: 0.0 },
32
- pageValidFlag: { type: Boolean, default: true },
33
- percentageOfShareholding: { type: Number, default: 100 },
29
+ netAssets1: { type: String, default: 0.0 },
30
+ netAssets2: { type: String, default: 0.0 },
31
+ netAssets3: { type: String, default: 0.0 },
32
+ pageValidFlag: { type: String, default: true },
33
+ percentageOfShareholding: { type: String, default: 100 },
34
34
  registeredAddressLine1: { type: String, default: '' },
35
35
  registeredAddressLine2: { type: String, default: '' },
36
36
  registeredAddressLine3: { type: String, default: '' },
@@ -39,12 +39,12 @@ const incomeSchema = new mongoose.Schema({
39
39
  registeredPostCode: { type: String, default: '' },
40
40
  registeredTelephone: { type: String, default: '' },
41
41
  selfEmployedDate: { type: Date, default: null },
42
- turnover1: { type: Number, default: 0.0 },
43
- turnover2: { type: Number, default: 0.0 },
44
- turnover3: { type: Number, default: 0.0 },
45
- year1: { type: Number, default: 0.0 },
46
- year2: { type: Number, default: 0.0 },
47
- year3: { type: Number, default: 0.0 },
42
+ turnover1: { type: String, default: 0.0 },
43
+ turnover2: { type: String, default: 0.0 },
44
+ turnover3: { type: String, default: 0.0 },
45
+ year1: { type: String, default: 0.0 },
46
+ year2: { type: String, default: 0.0 },
47
+ year3: { type: String, default: 0.0 },
48
48
  yearEnd1: { type: String, default: '' },
49
49
  yearEnd2: { type: String, default: '' },
50
50
  yearEnd3: { type: String, default: '' }
@@ -1,14 +1,14 @@
1
1
  import mongoose from "mongoose";
2
2
 
3
3
  const applicantOtherIncomeSchema = new mongoose.Schema({
4
- amount1: { type: Number },
5
- amount2: { type: Number },
6
- amount3: { type: Number },
7
- amount4: { type: Number },
8
- guaranteed1: { type: Boolean },
9
- guaranteed2: { type: Boolean },
10
- guaranteed3: { type: Boolean },
11
- guaranteed4: { type: Boolean },
4
+ amount1: { type: String },
5
+ amount2: { type: String },
6
+ amount3: { type: String },
7
+ amount4: { type: String },
8
+ guaranteed1: { type: String },
9
+ guaranteed2: { type: String },
10
+ guaranteed3: { type: String },
11
+ guaranteed4: { type: String },
12
12
  maintenance: { type: String },
13
13
  otherBenefits: { type: String },
14
14
  payFrequency1: { type: String },
@@ -4,7 +4,7 @@ const applicantRiskNarrativeSchema = new mongoose.Schema({
4
4
  call2StatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
5
5
  clientReference: { type: String },
6
6
  docVerificationStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
7
- isPoaTaskGenerated: { type: Boolean },
7
+ isPoaTaskGenerated: { type: String },
8
8
  link: { type: String },
9
9
  riskLevel: { type: String },
10
10
  riskRating: { type: String },
@@ -28,35 +28,35 @@ const applicantSchema = new mongoose.Schema({
28
28
  correspondenceAddressPostCode: { type: String, default: null },
29
29
  countryOfResidenceLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
30
30
  dateOfBirth: { type: Date, default: null },
31
- dependant10Age: { type: Number, default: 0 },
32
- dependant1Age: { type: Number, default: 0 },
33
- dependant2Age: { type: Number, default: 0 },
34
- dependant3Age: { type: Number, default: 0 },
35
- dependant4Age: { type: Number, default: 0 },
36
- dependant5Age: { type: Number, default: 0 },
37
- dependant6Age: { type: Number, default: 0 },
38
- dependant7Age: { type: Number, default: 0 },
39
- dependant8Age: { type: Number, default: 0 },
40
- dependant9Age: { type: Number, default: 0 },
31
+ dependant10Age: { type: String, default: 0 },
32
+ dependant1Age: { type: String, default: 0 },
33
+ dependant2Age: { type: String, default: 0 },
34
+ dependant3Age: { type: String, default: 0 },
35
+ dependant4Age: { type: String, default: 0 },
36
+ dependant5Age: { type: String, default: 0 },
37
+ dependant6Age: { type: String, default: 0 },
38
+ dependant7Age: { type: String, default: 0 },
39
+ dependant8Age: { type: String, default: 0 },
40
+ dependant9Age: { type: String, default: 0 },
41
41
  email: { type: String, default: null },
42
42
  employmentStatusDetails: { type: String, default: null },
43
43
  firstName: { type: String, default: null },
44
- isFirstTimelandlord: { type: Boolean, default: false },
44
+ isFirstTimelandlord: { type: String, default: false },
45
45
  foreignNationalsId: { type: String, default: null },
46
- gdprEmail: { type: Boolean, default: false },
47
- gdprPost: { type: Boolean, default: false },
48
- gdprTelephone: { type: Boolean, default: false },
49
- gdprTextMessage: { type: Boolean, default: false },
46
+ gdprEmail: { type: String, default: false },
47
+ gdprPost: { type: String, default: false },
48
+ gdprTelephone: { type: String, default: false },
49
+ gdprTextMessage: { type: String, default: false },
50
50
  gender: { type: String, default: null },
51
51
  hasBrokerGivenConsentForVulnerabilities: { type: String, default: null },
52
- hasLinkedJurisdiction: { type: Boolean, default: false },
53
- isCorrespondence: { type: Boolean, default: true },
54
- isCurrentContract: { type: Boolean, default: false },
55
- isCustomerVulnerable: { type: Boolean, default: false },
56
- isExpat: { type: Boolean, default: false },
57
- isFirstApplicant: { type: Boolean, default: false },
58
- isUkPassport: { type: Boolean, default: false },
59
- isUkResident: { type: Boolean, default: true },
52
+ hasLinkedJurisdiction: { type: String, default: false },
53
+ isCorrespondence: { type: String, default: true },
54
+ isCurrentContract: { type: String, default: false },
55
+ isCustomerVulnerable: { type: String, default: false },
56
+ isExpat: { type: String, default: false },
57
+ isFirstApplicant: { type: String, default: false },
58
+ isUkPassport: { type: String, default: false },
59
+ isUkResident: { type: String, default: true },
60
60
  lastName: { type: String, default: null },
61
61
  linkedJurisdictionCountry: { type: String, default: null },
62
62
  linkedJurisdictionDetails: { type: String, default: null },
@@ -66,8 +66,8 @@ const applicantSchema = new mongoose.Schema({
66
66
  nationalityLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
67
67
  netIncome: { type: String },
68
68
  niNumber: { type: String, default: null },
69
- numberOfDependants: { type: Number, default: 0 },
70
- isOneYearPrior: { type: Boolean, default: false },
69
+ numberOfDependants: { type: String, default: 0 },
70
+ isOneYearPrior: { type: String, default: false },
71
71
  phoneNumber: { type: String, default: null },
72
72
  previous1AddressCity: { type: String, default: null },
73
73
  previous1AddressCountryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
@@ -87,13 +87,13 @@ const applicantSchema = new mongoose.Schema({
87
87
  previous2AddressPropertyOwnedBy: { type: String, default: null },
88
88
  relationshipToOthersLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
89
89
  residentialStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
90
- retirementAge: { type: Number, default: 0 },
90
+ retirementAge: { type: String, default: 0 },
91
91
  taxJurisdiction: { type: String, default: null },
92
92
  taxPayerLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
93
93
  timeResidedAtCountryOfResidence: { type: String, default: null },
94
94
  title: { type: String, default: null },
95
- isTwoYearPrior: { type: Boolean, default: false },
96
- understandEnglish: { type: Boolean, default: true },
95
+ isTwoYearPrior: { type: String, default: false },
96
+ understandEnglish: { type: String, default: true },
97
97
  vulnerabilityNotes: { type: String, default: null },
98
98
  VulnerabilityTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
99
99
  creditData: applicantCreditDataSchema,
@@ -3,11 +3,11 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
3
3
 
4
4
  const applicationAuditSchema = new mongoose.Schema({
5
5
  auditId: {
6
- type: Number,
6
+ type: String,
7
7
  required: true
8
8
  },
9
9
  accountId: {
10
- type: Number,
10
+ type: String,
11
11
  required: true
12
12
  },
13
13
  auditCorrelationId: {
@@ -19,7 +19,7 @@ const applicationAuditSchema = new mongoose.Schema({
19
19
  required: true
20
20
  },
21
21
  changeType: {
22
- type: Number,
22
+ type: String,
23
23
  required: true
24
24
  },
25
25
  applicationId: {
@@ -9,28 +9,28 @@ const companySchema = new mongoose.Schema({
9
9
  addressLine3: { type: String, default: "" },
10
10
  addressPostCode: { type: String, default: "" },
11
11
  businessType: { type: String, default: "" },
12
- doYouKnowRegisteredNumber: { type: Boolean, default: false }, // e.g., true or false
12
+ doYouKnowRegisteredNumber: { type: String, default: false }, // e.g., true or false
13
13
  natureOfBusiness: { type: String, default: "" },
14
- netProfitYear1: { type: Number }, // e.g., 50000
15
- netProfitYear2: { type: Number }, // e.g., 75000
16
- netProfitYear3: { type: Number }, // e.g., 100000
14
+ netProfitYear1: { type: String, }, // e.g., 50000
15
+ netProfitYear2: { type: String, }, // e.g., 75000
16
+ netProfitYear3: { type: String, }, // e.g., 100000
17
17
  registeredName: { type: String, default: "" },
18
18
  registeredNumber: { type: String, default: "" },
19
19
  taxJurisdiction: { type: String, default: "" },
20
20
  tradingSince: { type: Date }, // e.g., "2020-01-01"
21
- turnoverYear1: { type: Number }, // e.g., 100000
22
- turnoverYear2: { type: Number }, // e.g., 150000
23
- turnoverYear3: { type: Number }, // e.g., 200000
21
+ turnoverYear1: { type: String }, // e.g., 100000
22
+ turnoverYear2: { type: String }, // e.g., 150000
23
+ turnoverYear3: { type: String }, // e.g., 200000
24
24
  yearEnd: { type: Date }, // e.g., "2023-12-31"
25
- yearEnd1: { type: Number }, // e.g., 2021
26
- yearEnd2: { type: Number }, // e.g., 2022
27
- yearEnd3: { type: Number }, // e.g., 2023
25
+ yearEnd1: { type: String }, // e.g., 2021
26
+ yearEnd2: { type: String }, // e.g., 2022
27
+ yearEnd3: { type: String }, // e.g., 2023
28
28
  sicCodes: [{ type: String, default: "" }], // e.g., "12345"
29
29
  epc: { type: String, default: "" }, // e.g., "A"
30
30
  tenure: { type: String, default: "" }, // e.g., "Leasehold"
31
31
  remainingLease: { type: String, default: "" }, // e.g., "85 years"
32
32
  dateOfIncorporation: { type: Date }, // e.g., "2010-06-15"
33
- existingMortgage: {type: Number } // e.g., "2"
33
+ existingMortgage: {type: String } // e.g., "2"
34
34
  });
35
35
 
36
36
  companySchema.plugin(mongooseEncryption);
@@ -1,13 +1,13 @@
1
1
  import mongoose from "mongoose";
2
2
 
3
3
  const creditProfileSchema = new mongoose.Schema({
4
- companyAnyVoluntaryEnforcedPossessionNo: { type: Boolean, default: false },
4
+ companyAnyVoluntaryEnforcedPossessionNo: { type: String, default: false },
5
5
  companyAnyVoluntaryEnforcedPossessionYes: { type: String, default: "" },
6
- companyBankruptcyNo: { type: Boolean, default: false },
6
+ companyBankruptcyNo: { type: String, default: false },
7
7
  companyBankruptcyYes: { type: String, default: "" },
8
- companyCCJInLastThreeYearNo: { type: Boolean, default: false },
8
+ companyCCJInLastThreeYearNo: { type: String, default: false },
9
9
  companyCCJInLastThreeYearYes: { type: String, default: "" },
10
- companyDefaultsInLastYearNo: { type: Boolean, default: false },
10
+ companyDefaultsInLastYearNo: { type: String, default: false },
11
11
  companyDefaultsInLastYearYes: { type: String, default: "" }
12
12
  });
13
13
  export default creditProfileSchema;
@@ -9,9 +9,9 @@ const directDebitSchema = new mongoose.Schema({
9
9
  city: { type: String, default: "" },
10
10
  contactPostcode: { type: String, default: "" },
11
11
  institution: { type: String, default: "" },
12
- isConfirmDeclaration: { type: Boolean, default: false },
12
+ isConfirmDeclaration: { type: String, default: false },
13
13
  nameOfAccountHolder: { type: String, default: "" },
14
- selectedPaymentDay: { type: Number, default: null },
14
+ selectedPaymentDay: { type: String, default: null },
15
15
  sortCode: { type: String, default: "" },
16
16
 
17
17
  });
@@ -14,17 +14,17 @@ const documentSchema = new mongoose.Schema({
14
14
  ref: "Lookup",
15
15
  required: false,
16
16
  },
17
- documentTypeId: { type: Number, required: false },
17
+ documentTypeId: { type: String, required: false },
18
18
  fileName: { type: String, required: false },
19
19
  contentType: { type: String, required: false },
20
20
  created: { type: Date, required: false },
21
- createdBy: { type: Number, required: false },
22
- isGenerated: { type: Boolean, required: false },
21
+ createdBy: { type: String, required: false },
22
+ isGenerated: { type: String, required: false },
23
23
  data: { type: String, required: false },
24
24
  envelopeId: { type: String, required: false },
25
25
  signers: { type: Array, default: [] },
26
26
  documentType: {
27
- documentTypeId: { type: Number, required: false },
27
+ documentTypeId: { type: String, required: false },
28
28
  displayName: { type: String, required: false },
29
29
  value: { type: String, required: false },
30
30
  data: { type: Object, required: false },
@@ -3,7 +3,7 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
3
3
 
4
4
  const fieldConfigSchema = new mongoose.Schema({
5
5
  fieldName: { type: String, required: true, unique: true },
6
- validateProductOnChange: { type: Boolean, default: true }
6
+ validateProductOnChange: { type: String, default: true }
7
7
  });
8
8
 
9
9
 
@@ -8,18 +8,18 @@ const mortgageSchema = new mongoose.Schema({
8
8
  fundRaisedFor: { type: String, default: "" },
9
9
  giftDetails: { type: String, default: "" },
10
10
  ifOtherDetails: { type: String, default: "" },
11
- isDistressedSale: { type: Boolean, default: false },
12
- isGovernmentInitiative: { type: Boolean, default: false },
13
- isPurchasedAsSale: { type: Boolean, default: false },
14
- isPurchasedBelowMarketValue: { type: Boolean, default: false },
15
- isReadyToSell: { type: Boolean, default: true },
16
- isTheIntentionToLet: { type: Boolean, default: true },
11
+ isDistressedSale: { type: String, default: false },
12
+ isGovernmentInitiative: { type: String, default: false },
13
+ isPurchasedAsSale: { type: String, default: false },
14
+ isPurchasedBelowMarketValue: { type: String, default: false },
15
+ isReadyToSell: { type: String, default: true },
16
+ isTheIntentionToLet: { type: String, default: true },
17
17
  leaseTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
18
- loanRequired: { type: Number, required: true },
19
- monthlyRentalIncome: { type: Number, required: true },
18
+ loanRequired: { type: String, required: true },
19
+ monthlyRentalIncome: { type: String, required: true },
20
20
  propertyValuationDetails: { type: String, default: "" },
21
21
  proposedTenants: { type: String },
22
- purchasePrice: { type: Number, required: true },
22
+ purchasePrice: { type: String, required: true },
23
23
  repaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
24
24
  repaymentVehicle: { type: String, default: "" },
25
25
  saleMade: { type: String, default: "" },
@@ -12,7 +12,7 @@ const noteSchema = new mongoose.Schema({
12
12
  default: null
13
13
  },
14
14
  createdBy: {
15
- type: Number,
15
+ type: String,
16
16
  default: null
17
17
  },
18
18
  createdByUserId: {
@@ -41,7 +41,7 @@ const noteSchema = new mongoose.Schema({
41
41
  default: ''
42
42
  },
43
43
  autoCreated: {
44
- type: Boolean,
44
+ type: String,
45
45
  default: false
46
46
  },
47
47
  additionalData: {
@@ -57,7 +57,7 @@ const noteSchema = new mongoose.Schema({
57
57
  default: ''
58
58
  },
59
59
  assignedBy: {
60
- type: Number,
60
+ type: String,
61
61
  default: null
62
62
  },
63
63
  assignedByUserId: {
@@ -1,7 +1,7 @@
1
1
  import mongoose from "mongoose";
2
2
 
3
3
  const productSchema = new mongoose.Schema({
4
- numberOfYearsToRepay: { type: Number, default: 0 },
4
+ numberOfYearsToRepay: { type: String, default: 0 },
5
5
  productFeePaymentType: { type: String, default: "" },
6
6
  selectedProduct: { type: String, default: "" }
7
7
  });
@@ -1,15 +1,15 @@
1
1
  import mongoose from "mongoose";
2
2
 
3
3
  const valuationSchema = new mongoose.Schema({
4
- amount: { type: Number },
4
+ amount: { type: String },
5
5
  epcRating: { type: String, default: "" },
6
- epcScore: { type: Number },
7
- estimatedRentalValue: { type: Number },
6
+ epcScore: { type: String },
7
+ estimatedRentalValue: { type: String },
8
8
  instructionId: { type: String, default: "" },
9
9
  instructionStatus: { type: String, default: "" },
10
10
  instructionStatusComment: { type: String, default: "" },
11
- isManual: { type: Boolean, default: false },
12
- squareMetres: { type: Number },
11
+ isManual: { type: String, default: false },
12
+ squareMetres: { type: String },
13
13
  valuerNotes: { type: String, default: "" },
14
14
  version: { type: String, default: "" }
15
15
  });
@@ -13,24 +13,24 @@ const applicationSchema = new mongoose.Schema(
13
13
  }],
14
14
  assignedToUserId: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
15
15
  applicationId: { type: String, required: true },
16
- isApplicationFeePaid: { type: Boolean, required: true },
16
+ isApplicationFeePaid: { type: String, required: true },
17
17
  applicationNumber: { type: String, required: true },
18
18
  applicationTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
19
19
  bankSolicitor: { type: String, default: "" },
20
20
  brokerId: { type: mongoose.Schema.Types.ObjectId, ref: "Broker", required: true },
21
21
  caseManager: { type: String, default: "" },
22
- caseManagerAccepted: { type: Boolean, default: false },
22
+ caseManagerAccepted: { type: String, default: false },
23
23
  completedReason: { type: String, default: "" },
24
- isIntendToOccupy: { type: Boolean, required: true },
24
+ isIntendToOccupy: { type: String, required: true },
25
25
  introducer: { type: String, default: "" },
26
- isIntroducerSubmission: { type: Boolean, required: true },
27
- isBrokerAssigned: { type: Boolean, default: false },
28
- isFinanceRecommendedToApplicant: { type: Boolean, required: true },
29
- isWorkflowTaskCreated: { type: Boolean, required: true },
26
+ isIntroducerSubmission: { type: String, required: true },
27
+ isBrokerAssigned: { type: String, default: false },
28
+ isFinanceRecommendedToApplicant: { type: String, required: true },
29
+ isWorkflowTaskCreated: { type: String, required: true },
30
30
  lastUpdated: { type: Date },
31
31
  lendingTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
32
32
  networkClubName: { type: String, default: "" },
33
- isNetworkClubSubmission: { type: Boolean, required: true },
33
+ isNetworkClubSubmission: { type: String, required: true },
34
34
  newReason: { type: String, default: "" },
35
35
  purchaseTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
36
36
  rejectedReason: { type: String, default: "" },
@@ -46,7 +46,7 @@ const applicationSchema = new mongoose.Schema(
46
46
  submitReason: { type: String, default: "" },
47
47
  submittedDate: { type: Date },
48
48
  underwriter: { type: String, default: "" },
49
- isValuationFeePaid: { type: Boolean, required: true },
49
+ isValuationFeePaid: { type: String, required: true },
50
50
  withdrawalReason: { type: String, default: "" },
51
51
  withdrawalReasonCode: { type: String, default: "" },
52
52
  productId: { type: mongoose.Schema.Types.ObjectId, ref: "Product", required: false },
@@ -58,16 +58,16 @@ const applicationSchema = new mongoose.Schema(
58
58
  ],
59
59
  statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
60
60
  submittedDate: { type: Date },
61
- isValuationFeePaid: { type: Boolean, required: true },
62
- isActive: { type: Boolean, default: false },
63
- isUkResident: { type: Boolean, default: true },
61
+ isValuationFeePaid: { type: String, required: true },
62
+ isActive: { type: String, default: false },
63
+ isUkResident: { type: String, default: true },
64
64
  riskRating: { type: String },
65
65
  directDebit: directDebitSchema,
66
66
  creditProfile: creditProfileSchema,
67
67
  mortgage: mortgageSchema,
68
68
  companyId: { type: mongoose.Schema.Types.ObjectId, ref: "ApplicationCompany" },
69
69
  rationaleId: { type: mongoose.Schema.Types.ObjectId, ref: "ApplicationRationale" },
70
- newAuditRecordsCount: { type: Number, default: 0 } // Ensure it is a Number
70
+ newAuditRecordsCount: { type: String, default: 0 } // Ensure it is a Number
71
71
  },
72
72
  {
73
73
  timestamps: true,
@@ -2,7 +2,7 @@ import mongoose from "mongoose";
2
2
  import mongooseEncryption from "../utils/encryption.middleware.js";
3
3
 
4
4
  const brokerSchema = new mongoose.Schema({
5
- brokerId: { type: Number },
5
+ brokerId: { type: String },
6
6
  landlinePhone: { type: String },
7
7
  mobileTelephone: { type: String },
8
8
  addressPostCode: { type: String },
@@ -18,13 +18,13 @@ const documentSchema = new mongoose.Schema({
18
18
  fileName: { type: String, required: false },
19
19
  contentType: { type: String, required: false },
20
20
  created: { type: Date, required: false },
21
- createdBy: { type: Number, required: false },
22
- isGenerated: { type: Boolean, required: false },
21
+ createdBy: { type: String, required: false },
22
+ isGenerated: { type: String, required: false },
23
23
  data: { type: String, required: false },
24
24
  envelopeId: { type: String, required: false },
25
25
  signers: { type: Array, default: [] },
26
26
  documentType: {
27
- documentTypeId: { type: Number, required: false },
27
+ documentTypeId: { type: String, required: false },
28
28
  displayName: { type: String, required: false },
29
29
  value: { type: String, required: false },
30
30
  data: { type: Object, required: false },
@@ -4,87 +4,87 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
4
4
  const feeSchema = new mongoose.Schema({
5
5
  feeType: { type: String, required: true },
6
6
  description: { type: String, required: true },
7
- feeAmount: { type: Number, required: true },
8
- rate: { type: Number, default: 0 },
9
- addedToLoan: { type: Boolean, default: false },
10
- allowOverride: { type: Boolean, default: false },
7
+ feeAmount: { type: String, required: true },
8
+ rate: { type: String, default: 0 },
9
+ addedToLoan: { type: String, default: false },
10
+ allowOverride: { type: String, default: false },
11
11
  additionalData: { type: mongoose.Schema.Types.Mixed, default: null }
12
12
  });
13
13
 
14
14
  const cashflowPeriodSchema = new mongoose.Schema({
15
- from: { type: Number, default: null },
16
- to: { type: Number, default: null },
17
- instalmentAmount: { type: Number, default: null },
18
- instalmentInterest: { type: Number, default: null },
19
- instalmentCapitalRepaid: { type: Number, default: null },
20
- otherCosts: { type: Number, default: 0 },
21
- outstandingCapital: { type: Number, default: null }
15
+ from: { type: String, default: null },
16
+ to: { type: String, default: null },
17
+ instalmentAmount: { type: String, default: null },
18
+ instalmentInterest: { type: String, default: null },
19
+ instalmentCapitalRepaid: { type: String, default: null },
20
+ otherCosts: { type: String, default: 0 },
21
+ outstandingCapital: { type: String, default: null }
22
22
  });
23
23
 
24
24
  const calculationsSchema = new mongoose.Schema({
25
- ltv: { type: Number, default: null },
26
- rentalCoverageRatioRate: { type: Number, default: null },
27
- bankContributionRate: { type: Number, default: null },
28
- bankInitialShareRate: { type: Number, default: null },
29
- totalAmountPayable: { type: Number, default: null },
30
- fixedMonthlyPayment: { type: Number, default: null },
31
- fixedMonthlyCapital: { type: Number, default: null },
32
- fixedMonthlyInterest: { type: Number, default: null },
33
- variableMonthlyPayment: { type: Number, default: null },
34
- summaryTotal: { type: Number, default: null },
35
- reimbursementPerPound: { type: Number, default: null },
36
- stressedPayment: { type: Number, default: null },
37
- stressedPaymentRate: { type: Number, default: null },
38
- rentalCoverage: { type: Number, default: null },
39
- rentalCoverageWithoutTopUp: { type: Number, default: null }
25
+ ltv: { type: String, default: null },
26
+ rentalCoverageRatioRate: { type: String, default: null },
27
+ bankContributionRate: { type: String, default: null },
28
+ bankInitialShareRate: { type: String, default: null },
29
+ totalAmountPayable: { type: String, default: null },
30
+ fixedMonthlyPayment: { type: String, default: null },
31
+ fixedMonthlyCapital: { type: String, default: null },
32
+ fixedMonthlyInterest: { type: String, default: null },
33
+ variableMonthlyPayment: { type: String, default: null },
34
+ summaryTotal: { type: String, default: null },
35
+ reimbursementPerPound: { type: String, default: null },
36
+ stressedPayment: { type: String, default: null },
37
+ stressedPaymentRate: { type: String, default: null },
38
+ rentalCoverage: { type: String, default: null },
39
+ rentalCoverageWithoutTopUp: { type: String, default: null }
40
40
  });
41
41
 
42
42
  const productFeaturesSchema = new mongoose.Schema({
43
43
  name: { type: String, required: true },
44
- clientAdvance: { type: Number, required: true },
45
- ltv: { type: Number, required: true },
46
- repayment: { type: Number, required: true },
47
- variableRepayment: { type: Number, required: true },
48
- reversionRateWithoutBaseRate: { type: Number, default: null },
49
- totalReversionRate: { type: Number, default: null },
50
- initialRate: { type: Number, required: true },
51
- fixedTerm: { type: Number, required: true },
44
+ clientAdvance: { type: String, required: true },
45
+ ltv: { type: String, required: true },
46
+ repayment: { type: String, required: true },
47
+ variableRepayment: { type: String, required: true },
48
+ reversionRateWithoutBaseRate: { type: String, default: null },
49
+ totalReversionRate: { type: String, default: null },
50
+ initialRate: { type: String, required: true },
51
+ fixedTerm: { type: String, required: true },
52
52
  fixedTermEndDate: { type: Date, default: null },
53
- baseRate: { type: Number, default: null },
54
- productRate: { type: Number, default: null },
55
- apr: { type: Number, default: null },
56
- rentalCoverage: { type: Number, default: null },
53
+ baseRate: { type: String, default: null },
54
+ productRate: { type: String, default: null },
55
+ apr: { type: String, default: null },
56
+ rentalCoverage: { type: String, default: null },
57
57
  repaymentType: { type: String, default: null },
58
58
  applicationCategory: { type: String, default: null },
59
59
  securityType: { type: String, default: null },
60
60
  erc: { type: String, default: null },
61
61
  loanType: { type: String, default: null },
62
62
  maxLtvLimit: { type: String, default: null },
63
- reimbursement: { type: Number, default: null },
64
- reimbursementPerPound: { type: Number, default: null },
65
- stressedApr: { type: Number, default: null },
66
- stressedRate: { type: Number, default: null },
67
- stressedRepayment: { type: Number, default: null },
63
+ reimbursement: { type: String, default: null },
64
+ reimbursementPerPound: { type: String, default: null },
65
+ stressedApr: { type: String, default: null },
66
+ stressedRate: { type: String, default: null },
67
+ stressedRepayment: { type: String, default: null },
68
68
  liborFloorRate: { type: String, default: null },
69
- totalTermInMonths: { type: Number, default: null },
69
+ totalTermInMonths: { type: String, default: null },
70
70
  chargeType: { type: String, default: '' },
71
71
  productCategory: { type: String, default: '' },
72
72
  ercCode: { type: String, default: '' },
73
- variableTerm: { type: Number, default: null },
74
- totalFeePayable: { type: Number, default: null },
73
+ variableTerm: { type: String, default: null },
74
+ totalFeePayable: { type: String, default: null },
75
75
  dipIssueDate: { type: Date, default: null },
76
76
  estimatedCompletionDate: { type: Date, default: null },
77
77
  dipExpiryDate: { type: Date, default: null },
78
78
  fixedRepaymentUntillDate: { type: Date, default: null },
79
79
  rentalReviewDate: { type: Date, default: null },
80
- totalReimbursementWithFee: { type: Number, default: null },
81
- finalRentPayment: { type: Number, default: null },
82
- clientDeposit: { type: Number, default: null },
83
- firstRentPayment: { type: Number, default: null },
80
+ totalReimbursementWithFee: { type: String, default: null },
81
+ finalRentPayment: { type: String, default: null },
82
+ clientDeposit: { type: String, default: null },
83
+ firstRentPayment: { type: String, default: null },
84
84
  fees: [feeSchema],
85
85
  ercFeatures: { type: mongoose.Schema.Types.Mixed, default: null },
86
86
  cashflowPeriods: {
87
- totalNoOfPayments: { type: Number, default: null },
87
+ totalNoOfPayments: { type: String, default: null },
88
88
  fixed: cashflowPeriodSchema,
89
89
  variable: cashflowPeriodSchema,
90
90
  total: cashflowPeriodSchema
@@ -92,8 +92,8 @@ const productFeaturesSchema = new mongoose.Schema({
92
92
  icr: { type: String, default: null },
93
93
  ufssProductCode: { type: String, default: null },
94
94
  ufssInterestRateCode: { type: String, default: null },
95
- stressedPayment: { type: Number, default: null },
96
- stressedPaymentRate: { type: Number, default: null },
95
+ stressedPayment: { type: String, default: null },
96
+ stressedPaymentRate: { type: String, default: null },
97
97
  calculations: calculationsSchema
98
98
  });
99
99
 
@@ -4,11 +4,11 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
4
4
  const Schema = mongoose.Schema;
5
5
 
6
6
  const solicitorSchema = new Schema({
7
- dualRep: { type: Boolean, default: false },
8
- isSraApprovedManagers: { type: Boolean, default: true },
9
- pageValidFlag: { type: Boolean, default: true },
7
+ dualRep: { type: String, default: false },
8
+ isSraApprovedManagers: { type: String, default: true },
9
+ pageValidFlag: { type: String, default: true },
10
10
  solicitorsList: { type: String},
11
- useExistingSolicitor: { type: Boolean, default: true },
11
+ useExistingSolicitor: { type: String, default: true },
12
12
  accountNumber: { type: String},
13
13
  addressCity: { type: String},
14
14
  addressCountryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
@@ -23,7 +23,7 @@ const solicitorSchema = new Schema({
23
23
  contactPostcode: { type: String, },
24
24
  email: { type: String },
25
25
  institution: { type: String },
26
- isActive: { type: Boolean, default: true },
26
+ isActive: { type: String, default: true },
27
27
  nameOfAccountHolder: { type: String },
28
28
  nameOfFirm: { type: String},
29
29
  signatory: { type: String},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "0.21.6",
4
- "description": "All the schemas for gatehouse bank back-end.",
3
+ "version": "0.21.8",
4
+ "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -8,10 +8,10 @@ const productCatalogueSchema = new mongoose.Schema({
8
8
  applyFrom: { type: Date, required: true },
9
9
  applyUntil: { type: Date, required: true },
10
10
  submitUntil: { type: Date, required: true },
11
- status: { type: Number, required: true },
12
- lockedForEdit: { type: Boolean, required: true },
11
+ status: { type: String, required: true },
12
+ lockedForEdit: { type: String, required: true },
13
13
  baseRateName: { type: String },
14
- baseRate: { type: Number },
14
+ baseRate: { type: String },
15
15
  mapperName: { type: String }
16
16
  }, {
17
17
  timestamps: true
@@ -7,19 +7,19 @@ const ruleSchema = new mongoose.Schema({
7
7
  name: { type: String, required: true },
8
8
  description: { type: String },
9
9
  scope: { type: String },
10
- mandatory: { type: Boolean, required: true },
10
+ mandatory: { type: String, required: true },
11
11
  overrideRuleType: { type: String },
12
12
  overrideRuleMessage: { type: String },
13
13
  inheritedFrom: { type: String },
14
- anyPass: { type: Boolean, required: true },
15
- preCashflow: { type: Boolean, required: true }
14
+ anyPass: { type: String, required: true },
15
+ preCashflow: { type: String, required: true }
16
16
  });
17
17
 
18
18
  const productDefinitionsSchema = new mongoose.Schema({
19
19
  productDefinitionId: { type: String, required: true },
20
20
  productCatalogueId: { ref: "ProductCatalogue", type: mongoose.Schema.Types.ObjectId, required: true },
21
21
  name: { type: String, required: true },
22
- atLeastOnePass: { type: Boolean, required: true },
22
+ atLeastOnePass: { type: String, required: true },
23
23
  elements: { type: [mongoose.Schema.Types.Mixed], default: [] },
24
24
  rules: { type: [ruleSchema], default: [] } // Embedded array of RuleSchema
25
25
  }, {
@@ -4,23 +4,23 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
4
4
  const dataStreetSchema = new mongoose.Schema({
5
5
  floorArea: { type: String, default: '' },
6
6
  propertyType: { type: String, default: '' },
7
- noOfBedrooms: { type: Number, default: 0 },
8
- noOfBathrooms: { type: Number, default: 0 },
7
+ noOfBedrooms: { type: String, default: 0 },
8
+ noOfBathrooms: { type: String, default: 0 },
9
9
  lats: { type: String, },
10
10
  longs: { type: String, },
11
11
  lmkKey: { type: String, default: '' },
12
- matchConfidence: { type: Number, default: 0 },
12
+ matchConfidence: { type: String, default: 0 },
13
13
  transactions:[{
14
14
  transactionDate: String,
15
15
  epc: String,
16
16
  price: String,
17
- isNewBuild: Boolean,
17
+ isNewBuild: String,
18
18
  }],
19
19
  nearByListings: [{
20
20
  listedDate: String,
21
- price: Number,
22
- noOfBedrooms: Number,
23
- noOfBathrooms: Number,
21
+ price: String,
22
+ noOfBedrooms: String,
23
+ noOfBathrooms: String,
24
24
  internalArea: String,
25
25
  distance: String,
26
26
  address: String,
@@ -28,9 +28,9 @@ const dataStreetSchema = new mongoose.Schema({
28
28
  }],
29
29
  nearByCompletedTransactions:[{
30
30
  transactionDate: String,
31
- price: Number,
32
- noOfBedrooms: Number,
33
- noOfBathrooms: Number,
31
+ price: String,
32
+ noOfBedrooms: String,
33
+ noOfBathrooms: String,
34
34
  internalArea: String,
35
35
  distance: String,
36
36
  address: String,
@@ -52,30 +52,30 @@ const dataStreetSchema = new mongoose.Schema({
52
52
  });
53
53
 
54
54
  const propertySchema = new mongoose.Schema({
55
- haveAnyBuyToLetProperties: { type: Boolean, required: true },
56
- isPropertyInEnglandOrWales: { type: Boolean, required: true },
55
+ haveAnyBuyToLetProperties: { type: String, required: true },
56
+ isPropertyInEnglandOrWales: { type: String, required: true },
57
57
  price: { type: String, default: '' },
58
- noOfBuyToLetProperties: { type: Number },
58
+ noOfBuyToLetProperties: { type: String },
59
59
  totalMonthlyRentalIncome: { type: String, default: '' },
60
60
  totalMonthlyRepayment: { type: String, default: '' },
61
61
  totalOutstandingBalance: { type: String, default: '' },
62
- areAllBedRoomsOver10sqm: { type: Boolean, required: true },
63
- isBrickTileConstruction: { type: Boolean, required: true },
62
+ areAllBedRoomsOver10sqm: { type: String, required: true },
63
+ isBrickTileConstruction: { type: String, required: true },
64
64
  constructionDetails: { type: String, default: '' },
65
- isExLAExclusion: { type: Boolean, required: true },
66
- isFlatLift: { type: Boolean, required: true },
67
- flatNumberOfBedrooms: { type: Number},
68
- isGreenEPC: { type: Boolean, required: true },
65
+ isExLAExclusion: { type: String, required: true },
66
+ isFlatLift: { type: String, required: true },
67
+ flatNumberOfBedrooms: { type: String},
68
+ isGreenEPC: { type: String, required: true },
69
69
  isGroundRent: { type: String, default: '' },
70
- isHouseLicensed: { type: Boolean, required: true },
71
- houseNumberOfFloors: { type: Number },
72
- houseNumberOfKitchens: { type: Number },
73
- houseNumberOfLivingRooms: { type: Number },
74
- houseNumberOfBathrooms: { type: Number },
75
- houseNumberOfTenancies: { type: Number },
76
- hasHousePlanningPermission: { type: Boolean, required: true },
77
- isGarage: { type: Boolean, required: true },
78
- isNewBuild: { type: Boolean, required: true },
70
+ isHouseLicensed: { type: String, required: true },
71
+ houseNumberOfFloors: { type: String },
72
+ houseNumberOfKitchens: { type: String },
73
+ houseNumberOfLivingRooms: { type: String },
74
+ houseNumberOfBathrooms: { type: String },
75
+ houseNumberOfTenancies: { type: String },
76
+ hasHousePlanningPermission: { type: String, required: true },
77
+ isGarage: { type: String, required: true },
78
+ isNewBuild: { type: String, required: true },
79
79
  propertyAddressCity: { type: String, required: true },
80
80
  propertyAddressCountry: { type: String, required: true },
81
81
  propertyAddressLine1: { type: String, required: true },
@@ -84,15 +84,15 @@ const propertySchema = new mongoose.Schema({
84
84
  propertyAddressPostCode: { type: String, required: true },
85
85
  propertyTenureLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
86
86
  propertyTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
87
- propertyYearBuilt: { type: Number },
88
- receiptOfAnyDiscount: { type: Boolean, },
87
+ propertyYearBuilt: { type: String },
88
+ receiptOfAnyDiscount: { type: String, },
89
89
  receiptOfDiscountDetails: { type: String, default: '' },
90
90
  sectorExperience: { type: String, required: true },
91
91
  serviceCharge: { type: String, default: '' },
92
92
  unexpiredRemainingLease: { type: String, default: '' },
93
93
  yearLeaseExpires: { type: String, default: '' },
94
94
  energyEfficiencyRating: { type: String},
95
- energyEfficiencyRatingValue: { type: Number },
95
+ energyEfficiencyRatingValue: { type: String },
96
96
  dataStreetSchema: dataStreetSchema,
97
97
  }, {
98
98
  toJSON: { virtuals: true },
@@ -20,7 +20,7 @@ const alertSchema = new mongoose.Schema({
20
20
  type: mongoose.Schema.Types.ObjectId,
21
21
  ref: "Lookup"
22
22
  },
23
- isActive: { type: Boolean, default: true },
23
+ isActive: { type: String, default: true },
24
24
  }, { timestamps: true });
25
25
 
26
26
  alertSchema.plugin(mongooseEncryption);
@@ -9,7 +9,7 @@ const ApprivoSyncJourneySchema = new mongoose.Schema({
9
9
  required: true
10
10
  },
11
11
  error: { type: String, default: null },
12
- isFirstPull: { type: Boolean, required: true },
12
+ isFirstPull: { type: String, required: true },
13
13
  jobRunId: { type: mongoose.Schema.Types.ObjectId, ref: "Job_Run"},
14
14
  startTime: {type: Date, default: null},
15
15
  endTime: {type: Date, default: null},
@@ -2,7 +2,7 @@ import mongoose from "mongoose";
2
2
 
3
3
  const jobSettingSchema = new mongoose.Schema({
4
4
  name: { type: String, required: true },
5
- isActive: { type: Boolean, default: true },
5
+ isActive: { type: String, default: true },
6
6
  frequency: {
7
7
  type: String, default: '2 hours'
8
8
  },
@@ -2,7 +2,7 @@ import mongoose from "mongoose";
2
2
  import mongooseEncryption from "../utils/encryption.middleware.js";
3
3
 
4
4
  const RoleGroupSchema = new mongoose.Schema({
5
- groupId: { type: Number, required: true },
5
+ groupId: { type: String, required: true },
6
6
  name: { type: String, required: true },
7
7
  description: { type: String },
8
8
  roles: [{
@@ -2,7 +2,7 @@ import mongoose from "mongoose";
2
2
  import mongooseEncryption from "../utils/encryption.middleware.js";
3
3
 
4
4
  const RoleSchema = new mongoose.Schema({
5
- roleId: { type: Number, required: true },
5
+ roleId: { type: String, required: true },
6
6
  name: { type: String, required: true },
7
7
  description: { type: String },
8
8
  permissions: [{
@@ -7,12 +7,12 @@ const ClaimSchema = new mongoose.Schema({
7
7
  });
8
8
 
9
9
  const userSchema = new mongoose.Schema({
10
- accountId: { type: Number, required: true },
10
+ accountId: { type: String, required: true },
11
11
  email: { type: String, required: true },
12
12
  fullName: { type: String, required: true },
13
13
  password: { type: String, required: true },
14
14
  organisationId: { type: mongoose.Schema.Types.Mixed },
15
- status: { type: Number, required: true },
15
+ status: { type: String, required: true },
16
16
  groups: [{
17
17
  type: mongoose.Schema.Types.ObjectId,
18
18
  ref: 'RoleGroup'
@@ -39,10 +39,10 @@ export default function mongooseEncryption(schema, options) {
39
39
 
40
40
  // Decrypt after bulkWrite operations
41
41
  schema.post("bulkWrite", function (result) {
42
- result.result.insertedDocs.forEach(doc => {
42
+ result.result.insertedIds.forEach(doc => {
43
43
  doc.set(decryptObject(doc.toObject(), collectionName)); // Decrypt document fields
44
44
  });
45
- result.result.modifiedDocs.forEach(doc => {
45
+ result.result.upserted.forEach(doc => {
46
46
  doc.set(decryptObject(doc.toObject(), collectionName)); // Decrypt document fields
47
47
  });
48
48
  });