@dynamatix/gb-schemas 0.21.11 → 0.21.13

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.
@@ -18,7 +18,7 @@ const applicantEmploymentSchema = new mongoose.Schema({
18
18
 
19
19
  classLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
20
20
  contractRemaining: { type: String },
21
- dateJoined: { type: Date },
21
+ dateJoined: { type: String },
22
22
  disabilityLiving: { type: String },
23
23
  employerName: { type: String },
24
24
  employerTelephone: { type: String },
@@ -37,8 +37,8 @@ const applicantEmploymentSchema = new mongoose.Schema({
37
37
  previousAddressLine3: { type: String },
38
38
  previousAddressPostCode: { type: String },
39
39
  previousBasicGrossIncome: { type: String },
40
- previousDateJoined: { type: Date },
41
- previousDateLeft: { type: Date },
40
+ previousDateJoined: { type: String },
41
+ previousDateLeft: { type: String },
42
42
  previousEmployerName: { type: String },
43
43
  previousEmployerTelephone: { type: String },
44
44
  previousJobTitle: { type: String },
@@ -20,8 +20,8 @@ const incomeSchema = new mongoose.Schema({
20
20
  businessType: { type: String, default: '4' },
21
21
  charteredCertifiedOrOther: { type: String, default: '' },
22
22
  contactName: { type: String, default: '' },
23
- currentYearEnd: { type: Date, default: null },
24
- dateEstablished: { type: Date, default: null },
23
+ currentYearEnd: { type: String, default: null },
24
+ dateEstablished: { type: String, default: null },
25
25
  doYouHaveAccountant: { type: String, default: false },
26
26
  isBusinessAddressDifferent: { type: String, default: false },
27
27
  nameOfBusiness: { type: String, default: '' },
@@ -38,7 +38,7 @@ const incomeSchema = new mongoose.Schema({
38
38
  registeredCountry: { type: String, default: 'GBR' },
39
39
  registeredPostCode: { type: String, default: '' },
40
40
  registeredTelephone: { type: String, default: '' },
41
- selfEmployedDate: { type: Date, default: null },
41
+ selfEmployedDate: { type: String, default: null },
42
42
  turnover1: { type: String, default: 0.0 },
43
43
  turnover2: { type: String, default: 0.0 },
44
44
  turnover3: { type: String, default: 0.0 },
@@ -18,7 +18,7 @@ const applicantSchema = new mongoose.Schema({
18
18
  addressLine1: { type: String, default: null },
19
19
  addressLine2: { type: String, default: null },
20
20
  addressLine3: { type: String, default: null },
21
- addressMovedDate: { type: Date, default: null },
21
+ addressMovedDate: { type: String, default: null },
22
22
  addressPostCode: { type: String, default: null },
23
23
  correspondenceAddressCity: { type: String, default: null },
24
24
  correspondenceAddressCountry: { type: String, default: null },
@@ -27,7 +27,7 @@ const applicantSchema = new mongoose.Schema({
27
27
  correspondenceAddressLine3: { type: String, default: null },
28
28
  correspondenceAddressPostCode: { type: String, default: null },
29
29
  countryOfResidenceLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
30
- dateOfBirth: { type: Date, default: null },
30
+ dateOfBirth: { type: String, default: null },
31
31
  dependant10Age: { type: String, default: 0 },
32
32
  dependant1Age: { type: String, default: 0 },
33
33
  dependant2Age: { type: String, default: 0 },
@@ -74,7 +74,7 @@ const applicantSchema = new mongoose.Schema({
74
74
  previous1AddressLine1: { type: String, default: null },
75
75
  previous1AddressLine2: { type: String, default: null },
76
76
  previous1AddressLine3: { type: String, default: null },
77
- previous1AddressMovedDate: { type: Date, default: null },
77
+ previous1AddressMovedDate: { type: String, default: null },
78
78
  previous1AddressPostCode: { type: String, default: null },
79
79
  previous1AddressPropertyOwnedBy: { type: String, default: null },
80
80
  previous2AddressCity: { type: String, default: null },
@@ -82,7 +82,7 @@ const applicantSchema = new mongoose.Schema({
82
82
  previous2AddressLine1: { type: String, default: null },
83
83
  previous2AddressLine2: { type: String, default: null },
84
84
  previous2AddressLine3: { type: String, default: null },
85
- previous2AddressMovedDate: { type: Date, default: null },
85
+ previous2AddressMovedDate: { type: String, default: null },
86
86
  previous2AddressPostCode: { type: String, default: null },
87
87
  previous2AddressPropertyOwnedBy: { type: String, default: null },
88
88
  relationshipToOthersLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
@@ -15,7 +15,7 @@ const applicationAuditSchema = new mongoose.Schema({
15
15
  required: true
16
16
  },
17
17
  auditDate: {
18
- type: Date,
18
+ type: String,
19
19
  required: true
20
20
  },
21
21
  changeType: {
@@ -4,19 +4,19 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
4
4
  const checkListItemSchema = new mongoose.Schema({
5
5
  additionalOfferConditions: { type: String, default: "" },
6
6
  appFormSignedNotes: { type: String, default: "" },
7
- applicationCompletionDate: { type: Date },
7
+ applicationCompletionDate: { type: String },
8
8
  buildingInsuranceInsurerName: { type: String, default: "" },
9
9
  buildingInsurancePolicyNumber: { type: String, default: "" },
10
10
  buildingInsuranceReceived: { type: String, default: "" },
11
- buildingInsuranceRenewalDate: { type: Date },
12
- dateOfValuationReceived: { type: Date },
11
+ buildingInsuranceRenewalDate: { type: String },
12
+ dateOfValuationReceived: { type: String },
13
13
  feePaidDocumentsDownloaded: { type: String, default: "" },
14
14
  feePaidNotes: { type: String, default: "" },
15
15
  fundsNotes: { type: String, default: "" },
16
- fundsReleasedDate: { type: Date },
16
+ fundsReleasedDate: { type: String },
17
17
  hasAllDocsReviewedAndAccepted: { type: String, default: "" },
18
18
  idnPorReceived: { type: String, default: "" },
19
- legalCompletionDate: { type: Date },
19
+ legalCompletionDate: { type: String },
20
20
  legalDocsReceived: { type: String, default: "" },
21
21
  legalNotes: { type: String, default: "" },
22
22
  ninetyDaysValuationAmount: { type: String, default: "" },
@@ -26,21 +26,21 @@ const checkListItemSchema = new mongoose.Schema({
26
26
  offerOfferPrepared: { type: String, default: "" },
27
27
  offerOfferReviewed: { type: String, default: "" },
28
28
  offerSignedNotes: { type: String, default: "" },
29
- offerSolicitorInstructedDate: { type: Date },
29
+ offerSolicitorInstructedDate: { type: String },
30
30
  packagingNotes: { type: String, default: "" },
31
31
  preOfferNotes: { type: String, default: "" },
32
32
  reinstatementAmount: { type: String, default: "" },
33
33
  rotReceived: { type: String, default: "" },
34
- rotReceivedDate: { type: Date },
34
+ rotReceivedDate: { type: String },
35
35
  salesContractReceived: { type: String, default: "" },
36
36
  underwritingNotes: { type: String, default: "" },
37
37
  underwritingValuationNotes: { type: String, default: "" },
38
- valuationAccepted: { type: Date },
38
+ valuationAccepted: { type: String },
39
39
  valuationFurtherConditions: { type: String, default: "" },
40
40
  valuationNotes: { type: String, default: "" },
41
- valuationReceived: { type: Date },
42
- valuationRequestedDate: { type: Date },
43
- valuationScheduledDate: { type: Date },
41
+ valuationReceived: { type: String },
42
+ valuationRequestedDate: { type: String },
43
+ valuationScheduledDate: { type: String },
44
44
  valuationSurveyorDetails: { type: String, default: "" }
45
45
  });
46
46
 
@@ -17,7 +17,7 @@ const documentSchema = new mongoose.Schema({
17
17
  documentTypeId: { type: String, required: false },
18
18
  fileName: { type: String, required: false },
19
19
  contentType: { type: String, required: false },
20
- created: { type: Date, required: false },
20
+ created: { type: String, required: false },
21
21
  createdBy: { type: String, required: false },
22
22
  isGenerated: { type: String, required: false },
23
23
  data: { type: String, required: false },
@@ -8,7 +8,7 @@ const noteSchema = new mongoose.Schema({
8
8
  default: null
9
9
  },
10
10
  createdOn: {
11
- type: Date,
11
+ type: String,
12
12
  default: null
13
13
  },
14
14
  createdBy: {
@@ -29,7 +29,7 @@ const noteSchema = new mongoose.Schema({
29
29
  required: true
30
30
  },
31
31
  reminderDate: {
32
- type: Date,
32
+ type: String,
33
33
  default: null
34
34
  },
35
35
  attachmentDocumentId: {
@@ -2,7 +2,7 @@ import mongoose from "mongoose";
2
2
  import mongooseEncryption from "../utils/encryption.middleware.js";
3
3
 
4
4
  const offerSchema = new mongoose.Schema({
5
- date: { type: Date } // The date associated with the offer
5
+ date: { type: String } // The date associated with the offer
6
6
  });
7
7
 
8
8
 
@@ -4,7 +4,7 @@ import mongooseEncryption from "../utils/encryption.middleware.js";
4
4
  const onboardingSchema = new mongoose.Schema({
5
5
  errors: { type: String, default: "" },
6
6
  status: { type: String, default: "" },
7
- statusDate: { type: Date },
7
+ statusDate: { type: String },
8
8
  warnings: { type: String, default: "" }
9
9
  });
10
10
 
@@ -27,7 +27,7 @@ const applicationSchema = new mongoose.Schema(
27
27
  isBrokerAssigned: { type: String, default: false },
28
28
  isFinanceRecommendedToApplicant: { type: String, required: true },
29
29
  isWorkflowTaskCreated: { type: String, required: true },
30
- lastUpdated: { type: Date },
30
+ lastUpdated: { type: String },
31
31
  lendingTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
32
32
  networkClubName: { type: String, default: "" },
33
33
  isNetworkClubSubmission: { type: String, required: true },
@@ -44,7 +44,7 @@ const applicationSchema = new mongoose.Schema(
44
44
  sowSalary: { type: String, default: "" },
45
45
  statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
46
46
  submitReason: { type: String, default: "" },
47
- submittedDate: { type: Date },
47
+ submittedDate: { type: String },
48
48
  underwriter: { type: String, default: "" },
49
49
  isValuationFeePaid: { type: String, required: true },
50
50
  withdrawalReason: { type: String, default: "" },
@@ -57,7 +57,7 @@ const applicationSchema = new mongoose.Schema(
57
57
  { type: mongoose.Schema.Types.ObjectId, ref: "Applicant" }
58
58
  ],
59
59
  statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
60
- submittedDate: { type: Date },
60
+ submittedDate: { type: String },
61
61
  isValuationFeePaid: { type: String, required: true },
62
62
  isActive: { type: String, default: false },
63
63
  isUkResident: { type: String, default: true },
@@ -17,7 +17,7 @@ const documentSchema = new mongoose.Schema({
17
17
  documentTypeId: { type: mongoose.Schema.Types.ObjectId, ref: "DocumentType", required: false },
18
18
  fileName: { type: String, required: false },
19
19
  contentType: { type: String, required: false },
20
- created: { type: Date, required: false },
20
+ created: { type: String, required: false },
21
21
  createdBy: { type: String, required: false },
22
22
  isGenerated: { type: String, required: false },
23
23
  data: { type: String, required: false },
@@ -49,7 +49,7 @@ const productFeaturesSchema = new mongoose.Schema({
49
49
  totalReversionRate: { type: String, default: null },
50
50
  initialRate: { type: String, required: true },
51
51
  fixedTerm: { type: String, required: true },
52
- fixedTermEndDate: { type: Date, default: null },
52
+ fixedTermEndDate: { type: String, default: null },
53
53
  baseRate: { type: String, default: null },
54
54
  productRate: { type: String, default: null },
55
55
  apr: { type: String, default: null },
@@ -72,11 +72,11 @@ const productFeaturesSchema = new mongoose.Schema({
72
72
  ercCode: { type: String, default: '' },
73
73
  variableTerm: { type: String, default: null },
74
74
  totalFeePayable: { type: String, default: null },
75
- dipIssueDate: { type: Date, default: null },
76
- estimatedCompletionDate: { type: Date, default: null },
77
- dipExpiryDate: { type: Date, default: null },
78
- fixedRepaymentUntillDate: { type: Date, default: null },
79
- rentalReviewDate: { type: Date, default: null },
75
+ dipIssueDate: { type: String, default: null },
76
+ estimatedCompletionDate: { type: String, default: null },
77
+ dipExpiryDate: { type: String, default: null },
78
+ fixedRepaymentUntillDate: { type: String, default: null },
79
+ rentalReviewDate: { type: String, default: null },
80
80
  totalReimbursementWithFee: { type: String, default: null },
81
81
  finalRentPayment: { type: String, default: null },
82
82
  clientDeposit: { type: String, default: null },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "0.21.11",
3
+ "version": "0.21.13",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,9 +5,9 @@ const productCatalogueSchema = new mongoose.Schema({
5
5
  productCatalogueId: { type: String, required: true },
6
6
  name: { type: String, required: true },
7
7
  description: { type: String },
8
- applyFrom: { type: Date, required: true },
9
- applyUntil: { type: Date, required: true },
10
- submitUntil: { type: Date, required: true },
8
+ applyFrom: { type: String, required: true },
9
+ applyUntil: { type: String, required: true },
10
+ submitUntil: { type: String, required: true },
11
11
  status: { type: String, required: true },
12
12
  lockedForEdit: { type: String, required: true },
13
13
  baseRateName: { type: String },
@@ -12,8 +12,7 @@ const ApprivoSyncJourneySchema = new mongoose.Schema({
12
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
- endTime: {type: Date, default: null},
16
- timestamp: { type: Date, default: Date.now }
15
+ endTime: { type: Date, default: null},
17
16
  }, {timestamps: true});
18
17
 
19
18
  const ApprivoSyncJourneyModel = mongoose.model('ApprivoSyncJourney', ApprivoSyncJourneySchema);
@@ -4,10 +4,10 @@ const errorSchema = new mongoose.Schema({
4
4
  error_message: { type: String, required: true },
5
5
  status_code: { type: Number, required: true },
6
6
  route: { type: String, required: true },
7
- timestamp: { type: Date, default: Date.now },
8
7
  user_agent: { type: String, required: true },
9
8
  stack_trace: [{ type: String }]
10
- });
9
+ },
10
+ { timestamps: true });
11
11
 
12
12
  const ErrorLogModel = mongoose.model("Error_Log", errorSchema);
13
13
  export default ErrorLogModel;
@@ -19,11 +19,11 @@ const userSchema = new mongoose.Schema({
19
19
  }],
20
20
  claims: [ClaimSchema],
21
21
  externalData: { type: mongoose.Schema.Types.Mixed },
22
- modifiedOn: { type: Date },
22
+ modifiedOn: { type: String },
23
23
  modifiedById: { type: String },
24
- createdOnInApprivo: { type: Date, default: Date.now },
24
+ createdOnInApprivo: { type: String},
25
25
  createdById: { type: String },
26
- deletedOn: { type: Date },
26
+ deletedOn: { type: String },
27
27
  deletedById: { type: String },
28
28
  token: { type: String }
29
29
  }, {
@@ -29,8 +29,12 @@ export const encryptObject = (obj, collectionName) => {
29
29
  let encryptedObj = {};
30
30
 
31
31
  for (const key in obj) {
32
- if (key === "_id" || mongoose.isValidObjectId(obj[key])) {
33
- encryptedObj[key] = obj[key]; // Don't encrypt _id
32
+ if (
33
+ key === "_id" ||
34
+ (Array.isArray(obj[key]) && obj[key].every(item => mongoose.isValidObjectId(item))) ||
35
+ mongoose.isValidObjectId(obj[key])
36
+ ) {
37
+ encryptedObj[key] = obj[key]; // Don't encrypt ObjectId references
34
38
  } else {
35
39
  const iv = crypto.randomBytes(IV_LENGTH); // Generate IV
36
40
  const cipher = crypto.createCipheriv("aes-256-gcm", SECRET_KEY, iv);