@dynamatix/gb-schemas 0.18.3 → 0.19.1
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.
- package/applicants/applicant.model.js +2 -0
- package/applications/application-audit.model.js +3 -0
- package/applications/application-checklist-Item.model.js +2 -0
- package/applications/application-company-model.js +3 -0
- package/applications/application-document.model.js +2 -0
- package/applications/application-fieldconfig.model.js +3 -0
- package/applications/application-illustration-model.js +2 -0
- package/applications/application-legal.model.js +4 -0
- package/applications/application-mortgage.model.js +2 -0
- package/applications/application-note.model.js +2 -0
- package/applications/application-offer.model.js +4 -0
- package/applications/application-onboarding.model.js +4 -0
- package/applications/application-rationale.model.js +2 -0
- package/applications/application-risk-narrative.model.js +2 -1
- package/applications/application.model.js +2 -0
- package/applications/broker.model.js +2 -0
- package/applications/document.model.js +2 -0
- package/applications/productfeatures.model.js +2 -0
- package/applications/solicitor.model.js +1 -1
- package/package.json +1 -1
- package/product-catalogues/product-catalogue.model.js +4 -2
- package/product-catalogues/product-definitions.model.js +6 -4
- package/product-catalogues/product-variant.model.js +4 -2
- package/properties/property.model.js +2 -0
- package/shared/alert.model.js +2 -0
- package/shared/checklist.model.js +2 -0
- package/shared/lookup-group.model.js +2 -0
- package/shared/lookup.model.js +2 -0
- package/shared/task-document.model.js +2 -0
- package/shared/task.model.js +7 -5
- package/users/user.model.js +4 -2
|
@@ -9,6 +9,7 @@ import applicantCommitmentSchema from "./applicant-commitment.model.js";
|
|
|
9
9
|
import applicantDirectDebitSchema from "./applicant-direct-debit.model.js";
|
|
10
10
|
import creditProfileSchema from "./applicant-credit-profile.model.js";
|
|
11
11
|
import incomeSchema from "./applicant-income.model.js";
|
|
12
|
+
import mongooseEncryption from "../utils/encryption.middleware.js";
|
|
12
13
|
|
|
13
14
|
const applicantSchema = new mongoose.Schema({
|
|
14
15
|
applicantId: { type: String, required: true },
|
|
@@ -159,5 +160,6 @@ applicantSchema.virtual('vulnerabilityType').get(function () {
|
|
|
159
160
|
return this.VulnerabilityTypeLid?.name ?? null;
|
|
160
161
|
});
|
|
161
162
|
|
|
163
|
+
applicantSchema.plugin(mongooseEncryption);
|
|
162
164
|
const ApplicantModel = mongoose.model("Applicant", applicantSchema);
|
|
163
165
|
export default ApplicantModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const applicationAuditSchema = new mongoose.Schema({
|
|
4
5
|
auditId: {
|
|
@@ -40,5 +41,7 @@ const applicationAuditSchema = new mongoose.Schema({
|
|
|
40
41
|
}
|
|
41
42
|
},{ timestamps: true });
|
|
42
43
|
|
|
44
|
+
|
|
45
|
+
applicationAuditSchema.plugin(mongooseEncryption);
|
|
43
46
|
const ApplicationAuditModel = mongoose.model('ApplicationAudit', applicationAuditSchema);
|
|
44
47
|
export default ApplicationAuditModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const checkListItemSchema = new mongoose.Schema({
|
|
4
5
|
additionalOfferConditions: { type: String, default: "" },
|
|
@@ -43,5 +44,6 @@ const checkListItemSchema = new mongoose.Schema({
|
|
|
43
44
|
valuationSurveyorDetails: { type: String, default: "" }
|
|
44
45
|
});
|
|
45
46
|
|
|
47
|
+
checkListItemSchema.plugin(mongooseEncryption);
|
|
46
48
|
const ApplicationCheckListModel = mongoose.model("ApplicationCheckList", checkListItemSchema);
|
|
47
49
|
export default ApplicationCheckListModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const companySchema = new mongoose.Schema({
|
|
4
5
|
addressCity: { type: String, default: "" },
|
|
@@ -31,5 +32,7 @@ const companySchema = new mongoose.Schema({
|
|
|
31
32
|
dateOfIncorporation: { type: Date }, // e.g., "2010-06-15"
|
|
32
33
|
existingMortgage: {type: Number } // e.g., "2"
|
|
33
34
|
});
|
|
35
|
+
|
|
36
|
+
companySchema.plugin(mongooseEncryption);
|
|
34
37
|
const ApplicationCompanyModel = mongoose.model("ApplicationCompany", companySchema);
|
|
35
38
|
export default ApplicationCompanyModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const documentSchema = new mongoose.Schema({
|
|
4
5
|
applicationId: {
|
|
@@ -33,5 +34,6 @@ const documentSchema = new mongoose.Schema({
|
|
|
33
34
|
timestamps: true
|
|
34
35
|
});
|
|
35
36
|
|
|
37
|
+
documentSchema.plugin(mongooseEncryption);
|
|
36
38
|
const ApplicationDocumentModel = mongoose.model("ApplicationDocument", documentSchema);
|
|
37
39
|
export default ApplicationDocumentModel;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const fieldConfigSchema = new mongoose.Schema({
|
|
4
5
|
fieldName: { type: String, required: true, unique: true },
|
|
5
6
|
validateProductOnChange: { type: Boolean, default: true }
|
|
6
7
|
});
|
|
7
8
|
|
|
9
|
+
|
|
10
|
+
fieldConfigSchema.plugin(mongooseEncryption);
|
|
8
11
|
const ApplicationFieldConfigModel = mongoose.model('FieldConfig', fieldConfigSchema);
|
|
9
12
|
export default ApplicationFieldConfigModel;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const illustrationSchema = new mongoose.Schema({
|
|
4
5
|
date: { type: Date } // e.g., the date of illustration
|
|
5
6
|
});
|
|
6
7
|
|
|
8
|
+
illustrationSchema.plugin(mongooseEncryption);
|
|
7
9
|
const IllustrationModel = mongoose.model("Illustration", illustrationSchema);
|
|
8
10
|
export default IllustrationModel;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const legalSchema = new mongoose.Schema({
|
|
4
5
|
assignedSolicitor: { type: String, default: "" },
|
|
5
6
|
solicitorsReference: { type: String, default: "" }
|
|
6
7
|
});
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
legalSchema.plugin(mongooseEncryption);
|
|
7
11
|
const LegalModel = mongoose.model("Legal", legalSchema);
|
|
8
12
|
export default LegalModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const mortgageSchema = new mongoose.Schema({
|
|
4
5
|
depositComeFrom: { type: String, required: true },
|
|
@@ -28,4 +29,5 @@ const mortgageSchema = new mongoose.Schema({
|
|
|
28
29
|
vendorsName: { type: String, default: "" }
|
|
29
30
|
});
|
|
30
31
|
|
|
32
|
+
mortgageSchema.plugin(mongooseEncryption);
|
|
31
33
|
export default mortgageSchema;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const noteSchema = new mongoose.Schema({
|
|
4
5
|
applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true },
|
|
@@ -72,5 +73,6 @@ const noteSchema = new mongoose.Schema({
|
|
|
72
73
|
},
|
|
73
74
|
});
|
|
74
75
|
|
|
76
|
+
noteSchema.plugin(mongooseEncryption);
|
|
75
77
|
const ApplictionNoteModel = mongoose.model("ApplictionNote", noteSchema);
|
|
76
78
|
export default ApplictionNoteModel;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const offerSchema = new mongoose.Schema({
|
|
4
5
|
date: { type: Date } // The date associated with the offer
|
|
5
6
|
});
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
offerSchema.plugin(mongooseEncryption);
|
|
6
10
|
const OfferModel = mongoose.model("Offer", offerSchema);
|
|
7
11
|
export default OfferModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const onboardingSchema = new mongoose.Schema({
|
|
4
5
|
errors: { type: String, default: "" },
|
|
@@ -6,5 +7,8 @@ const onboardingSchema = new mongoose.Schema({
|
|
|
6
7
|
statusDate: { type: Date },
|
|
7
8
|
warnings: { type: String, default: "" }
|
|
8
9
|
});
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
onboardingSchema.plugin(mongooseEncryption);
|
|
9
13
|
const ApplicationOnboardingModel = mongoose.model("ApplicationOnboarding", onboardingSchema);
|
|
10
14
|
export default ApplicationOnboardingModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const rationaleSchema = new mongoose.Schema({
|
|
4
5
|
applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true },
|
|
@@ -36,5 +37,6 @@ const rationaleSchema = new mongoose.Schema({
|
|
|
36
37
|
propertyStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
|
|
37
38
|
});
|
|
38
39
|
|
|
40
|
+
rationaleSchema.plugin(mongooseEncryption);
|
|
39
41
|
const ApplicationRationaleModel = mongoose.model("ApplicationRationale", rationaleSchema);
|
|
40
42
|
export default ApplicationRationaleModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
+
import mongooseEncryption from '../utils/encryption.middleware';
|
|
2
3
|
|
|
3
4
|
const applicantionRiskNarrativeSchema = new mongoose.Schema({
|
|
4
5
|
call1RequestedOn: { type: String },
|
|
@@ -10,7 +11,7 @@ const applicantionRiskNarrativeSchema = new mongoose.Schema({
|
|
|
10
11
|
statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
11
12
|
});
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
applicantionRiskNarrativeSchema.plugin(mongooseEncryption);
|
|
14
15
|
const ApplicationRiskNarrativeModel = mongoose.model('ApplicationRiskNarrative', applicantionRiskNarrativeSchema);
|
|
15
16
|
export default ApplicationRiskNarrativeModel;
|
|
16
17
|
|
|
@@ -2,6 +2,7 @@ import mongoose from "mongoose";
|
|
|
2
2
|
import directDebitSchema from "./application-direct-debit.model.js";
|
|
3
3
|
import creditProfileSchema from "./application-credit-profile.model.js";
|
|
4
4
|
import mortgageSchema from "./application-mortgage.model.js";
|
|
5
|
+
import mongooseEncryption from "../utils/encryption.middleware.js";
|
|
5
6
|
|
|
6
7
|
const applicationSchema = new mongoose.Schema(
|
|
7
8
|
{
|
|
@@ -146,5 +147,6 @@ applicationSchema.virtual('solicitorPhone').get(function () {
|
|
|
146
147
|
return this.solicitorId ? this.solicitorId?.telephone : null;
|
|
147
148
|
});
|
|
148
149
|
|
|
150
|
+
applicationSchema.plugin(mongooseEncryption);
|
|
149
151
|
const ApplicationModel = mongoose.model("Application", applicationSchema);
|
|
150
152
|
export default ApplicationModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const brokerSchema = new mongoose.Schema({
|
|
4
5
|
brokerId: { type: Number },
|
|
@@ -21,5 +22,6 @@ const brokerSchema = new mongoose.Schema({
|
|
|
21
22
|
{ timestamps: true });
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
brokerSchema.plugin(mongooseEncryption);
|
|
24
26
|
const BrokerModel = mongoose.model("Broker", brokerSchema);
|
|
25
27
|
export default BrokerModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const documentSchema = new mongoose.Schema({
|
|
4
5
|
applicationId: {
|
|
@@ -33,5 +34,6 @@ const documentSchema = new mongoose.Schema({
|
|
|
33
34
|
timestamps: true
|
|
34
35
|
});
|
|
35
36
|
|
|
37
|
+
documentSchema.plugin(mongooseEncryption);
|
|
36
38
|
const DocumentModel = mongoose.model("Document", documentSchema);
|
|
37
39
|
export default DocumentModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const feeSchema = new mongoose.Schema({
|
|
4
5
|
feeType: { type: String, required: true },
|
|
@@ -96,5 +97,6 @@ const productFeaturesSchema = new mongoose.Schema({
|
|
|
96
97
|
calculations: calculationsSchema
|
|
97
98
|
});
|
|
98
99
|
|
|
100
|
+
productFeaturesSchema.plugin(mongooseEncryption);
|
|
99
101
|
const ProductFeaturesModel = mongoose.model("ProductFeature", productFeaturesSchema);
|
|
100
102
|
export default ProductFeaturesModel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const productCatalogueSchema = new mongoose.Schema({
|
|
4
5
|
productCatalogueId: { type: String, required: true },
|
|
5
6
|
name: { type: String, required: true },
|
|
6
7
|
description: { type: String },
|
|
@@ -16,5 +17,6 @@ const ProductCatalogueSchema = new mongoose.Schema({
|
|
|
16
17
|
timestamps: true
|
|
17
18
|
});
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
productCatalogueSchema.plugin(mongooseEncryption);
|
|
21
|
+
const ProductCatalogueModel = mongoose.model('ProductCatalogue', productCatalogueSchema);
|
|
20
22
|
export default ProductCatalogueModel;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const ruleSchema = new mongoose.Schema({
|
|
4
5
|
ruleId: { type: String, required: true },
|
|
5
6
|
rule: { type: String, required: true }, // Storing as a string (JSON stringified)
|
|
6
7
|
name: { type: String, required: true },
|
|
@@ -14,16 +15,17 @@ const RuleSchema = new mongoose.Schema({
|
|
|
14
15
|
preCashflow: { type: Boolean, required: true }
|
|
15
16
|
});
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
+
const productDefinitionsSchema = new mongoose.Schema({
|
|
18
19
|
productDefinitionId: { type: String, required: true },
|
|
19
20
|
productCatalogueId: { ref: "ProductCatalogue", type: mongoose.Schema.Types.ObjectId, required: true },
|
|
20
21
|
name: { type: String, required: true },
|
|
21
22
|
atLeastOnePass: { type: Boolean, required: true },
|
|
22
23
|
elements: { type: [mongoose.Schema.Types.Mixed], default: [] },
|
|
23
|
-
rules: { type: [
|
|
24
|
+
rules: { type: [ruleSchema], default: [] } // Embedded array of RuleSchema
|
|
24
25
|
}, {
|
|
25
26
|
timestamps: true
|
|
26
27
|
});
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
productDefinitionsSchema.plugin(mongooseEncryption);
|
|
30
|
+
const ProductDefinitionsModel = mongoose.model('ProductDefinitions', productDefinitionsSchema);
|
|
29
31
|
export default ProductDefinitionsModel;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const productVariantSchema = new mongoose.Schema({
|
|
4
5
|
productCatalogueId: { ref: "ProductCatalogue", type: mongoose.Schema.Types.ObjectId, required: true },
|
|
5
6
|
varientid: { type: String, required: true },
|
|
6
7
|
name: { type: String, required: true },
|
|
@@ -11,5 +12,6 @@ const VariantSchema = new mongoose.Schema({
|
|
|
11
12
|
timestamps: true
|
|
12
13
|
});
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
productVariantSchema.plugin(mongooseEncryption);
|
|
16
|
+
const VariantModel = mongoose.model('ProductVariant', productVariantSchema);
|
|
15
17
|
export default VariantModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const dataStreetSchema = new mongoose.Schema({
|
|
4
5
|
floorArea: { type: String, default: '' },
|
|
@@ -109,5 +110,6 @@ propertySchema.virtual('tenure').get(function () {
|
|
|
109
110
|
return this.propertyTypeLid ? this.propertyTypeLid.name : null;
|
|
110
111
|
});
|
|
111
112
|
|
|
113
|
+
propertySchema.plugin(mongooseEncryption);
|
|
112
114
|
const PropertyModel = mongoose.model("Property", propertySchema);
|
|
113
115
|
export default PropertyModel;
|
package/shared/alert.model.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const alertSchema = new mongoose.Schema({
|
|
4
5
|
alertTypeLid: {
|
|
@@ -22,6 +23,7 @@ const alertSchema = new mongoose.Schema({
|
|
|
22
23
|
isActive: { type: Boolean, default: true },
|
|
23
24
|
}, { timestamps: true });
|
|
24
25
|
|
|
26
|
+
alertSchema.plugin(mongooseEncryption);
|
|
25
27
|
const AlertModel = mongoose.model("Alert", alertSchema);
|
|
26
28
|
|
|
27
29
|
export default AlertModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const checklistSchema = new mongoose.Schema({
|
|
4
5
|
checkTypeLid: {
|
|
@@ -30,6 +31,7 @@ const checklistSchema = new mongoose.Schema({
|
|
|
30
31
|
|
|
31
32
|
checklistSchema.index({ checkDescription: 'text', source: 'text' });
|
|
32
33
|
|
|
34
|
+
checklistSchema.plugin(mongooseEncryption);
|
|
33
35
|
const CheckListModel = mongoose.model("CheckList", checklistSchema);
|
|
34
36
|
|
|
35
37
|
export default CheckListModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const lookupGroupSchema = new mongoose.Schema({
|
|
4
5
|
name: {
|
|
@@ -13,5 +14,6 @@ const lookupGroupSchema = new mongoose.Schema({
|
|
|
13
14
|
],
|
|
14
15
|
});
|
|
15
16
|
|
|
17
|
+
lookupGroupSchema.plugin(mongooseEncryption);
|
|
16
18
|
const LookupGroupModel = mongoose.model('LookupGroup', lookupGroupSchema);
|
|
17
19
|
export default LookupGroupModel;
|
package/shared/lookup.model.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const lookupSchema = new mongoose.Schema({
|
|
4
5
|
name: {
|
|
@@ -18,5 +19,6 @@ const lookupSchema = new mongoose.Schema({
|
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
|
|
22
|
+
lookupSchema.plugin(mongooseEncryption);
|
|
21
23
|
const LookupModel = mongoose.model('Lookup', lookupSchema);
|
|
22
24
|
export default LookupModel;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
+
import mongooseEncryption from '../utils/encryption.middleware';
|
|
2
3
|
|
|
3
4
|
// Define the schema for TaskDocumentType
|
|
4
5
|
const taskDocumentTypeSchema = new mongoose.Schema({
|
|
@@ -22,6 +23,7 @@ const taskDocumentTypeSchema = new mongoose.Schema({
|
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
// Create the Mongoose model
|
|
26
|
+
taskDocumentTypeSchema.plugin(mongooseEncryption);
|
|
25
27
|
const TaskDocumentTypeModel = mongoose.model('TaskDocumentType', taskDocumentTypeSchema);
|
|
26
28
|
|
|
27
29
|
export default TaskDocumentTypeModel;
|
package/shared/task.model.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const { Schema } = mongoose;
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const actionSchema = new Schema({
|
|
6
7
|
type: { type: String, required: true }, // Type of the action
|
|
7
8
|
message: { type: String, required: false },
|
|
8
9
|
target: { type: String, required: false },
|
|
9
10
|
});
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const taskSchema = new Schema({
|
|
13
14
|
name: { type: String, required: true },
|
|
14
15
|
description: { type: String, required: true },
|
|
15
|
-
actionsOnFailure: { type: [
|
|
16
|
-
actionsOnSuccess: { type: [
|
|
16
|
+
actionsOnFailure: { type: [actionSchema], default: [] },
|
|
17
|
+
actionsOnSuccess: { type: [actionSchema], default: [] },
|
|
17
18
|
}, { timestamps: true });
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
taskSchema.plugin(mongooseEncryption);
|
|
21
|
+
const TaskModel = mongoose.model("Task", taskSchema);
|
|
20
22
|
export default TaskModel;
|
package/users/user.model.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
+
import mongooseEncryption from "../utils/encryption.middleware";
|
|
2
3
|
|
|
3
4
|
const ClaimSchema = new mongoose.Schema({
|
|
4
5
|
key: { type: String, required: true },
|
|
5
6
|
value: { type: String, required: true }
|
|
6
7
|
});
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const userSchema = new mongoose.Schema({
|
|
9
10
|
accountId: { type: Number, required: true },
|
|
10
11
|
email: { type: String, required: true },
|
|
11
12
|
fullName: { type: String, required: true },
|
|
@@ -29,6 +30,7 @@ const UserSchema = new mongoose.Schema({
|
|
|
29
30
|
timestamps: true
|
|
30
31
|
});
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
userSchema.plugin(mongooseEncryption);
|
|
34
|
+
const UserModel = mongoose.model('User', userSchema);
|
|
33
35
|
|
|
34
36
|
export default UserModel;
|