@dynamatix/gb-schemas 0.0.2

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 (38) hide show
  1. package/.github/workflows/npm-publish.yml +76 -0
  2. package/applicants/applicant-commitment.model.js +13 -0
  3. package/applicants/applicant-credit-data.model.js +13 -0
  4. package/applicants/applicant-credit-profile.model.js +22 -0
  5. package/applicants/applicant-direct-debit.model.js +19 -0
  6. package/applicants/applicant-employment.model.js +53 -0
  7. package/applicants/applicant-expenditure.model.js +12 -0
  8. package/applicants/applicant-income-source.model.js +11 -0
  9. package/applicants/applicant-income.model.js +53 -0
  10. package/applicants/applicant-other-income.model.js +25 -0
  11. package/applicants/applicant-risk-narrative.model.js +15 -0
  12. package/applicants/applicant.model.js +110 -0
  13. package/applications/application-audit.model.js +47 -0
  14. package/applications/application-checklist-Item.model.js +47 -0
  15. package/applications/application-company-model.js +29 -0
  16. package/applications/application-credit-profile.model.js +14 -0
  17. package/applications/application-illustration-model.js +8 -0
  18. package/applications/application-legal.model.js +8 -0
  19. package/applications/application-mortgage.model.js +31 -0
  20. package/applications/application-note.model.js +76 -0
  21. package/applications/application-offer.model.js +7 -0
  22. package/applications/application-onboarding.model.js +10 -0
  23. package/applications/application-product.model.js +11 -0
  24. package/applications/application-rational.model.js +20 -0
  25. package/applications/application-valuation.model.js +17 -0
  26. package/applications/application.model.js +69 -0
  27. package/applications/broker.model.js +25 -0
  28. package/applications/document.model.js +37 -0
  29. package/applications/productfeatures.model.js +100 -0
  30. package/applications/solicitor.model.js +35 -0
  31. package/package.json +23 -0
  32. package/properties/property.model.js +99 -0
  33. package/shared/lookup-group.model.js +17 -0
  34. package/shared/lookup.model.js +22 -0
  35. package/shared/system-parameter.model.js +34 -0
  36. package/users/role-group.model.js +16 -0
  37. package/users/role.model.js +14 -0
  38. package/users/user.model.js +32 -0
@@ -0,0 +1,76 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const noteSchema = new mongoose.Schema({
4
+ applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true },
5
+ noteId: {
6
+ type: String,
7
+ required: true
8
+ },
9
+ createdOn: {
10
+ type: Date,
11
+ required: true
12
+ },
13
+ createdBy: {
14
+ type: Number,
15
+ required: true
16
+ },
17
+ createdByUserId: {
18
+ type: mongoose.Schema.Types.ObjectId, ref: "User",
19
+ },
20
+ TypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
21
+ SubTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
22
+ subject: {
23
+ type: String,
24
+ required: true
25
+ },
26
+ note: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ reminderDate: {
31
+ type: Date,
32
+ default: null
33
+ },
34
+ attachmentDocumentId: {
35
+ type: String,
36
+ default: null
37
+ },
38
+ assignedOperation: {
39
+ type: String,
40
+ default: ''
41
+ },
42
+ autoCreated: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ additionalData: {
47
+ type: mongoose.Schema.Types.Mixed,
48
+ default: null
49
+ },
50
+ autoCreatedId: {
51
+ type: String,
52
+ default: null
53
+ },
54
+ assignedTo: {
55
+ type: String,
56
+ default: ''
57
+ },
58
+ assignedBy: {
59
+ type: Number,
60
+ default: null
61
+ },
62
+ assignedByUserId: {
63
+ type: mongoose.Schema.Types.ObjectId, ref: "User",
64
+ },
65
+ comment: {
66
+ type: String,
67
+ required: false
68
+ },
69
+ reminderStatus: {
70
+ type: String,
71
+ default: 'None'
72
+ },
73
+ });
74
+
75
+ const ApplictionNoteModel = mongoose.model("ApplictionNote", noteSchema);
76
+ export default ApplictionNoteModel;
@@ -0,0 +1,7 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const offerSchema = new mongoose.Schema({
4
+ date: { type: Date } // The date associated with the offer
5
+ });
6
+ const OfferModel = mongoose.model("Offer", offerSchema);
7
+ export default OfferModel;
@@ -0,0 +1,10 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const onboardingSchema = new mongoose.Schema({
4
+ errors: { type: String, default: "" },
5
+ status: { type: String, default: "" },
6
+ statusDate: { type: Date },
7
+ warnings: { type: String, default: "" }
8
+ });
9
+ const OnboardingModel = mongoose.model("Onboarding", onboardingSchema);
10
+ export default OnboardingModel;
@@ -0,0 +1,11 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const productSchema = new mongoose.Schema({
4
+ numberOfYearsToRepay: { type: Number, default: 0 },
5
+ productFeePaymentType: { type: String, default: "" },
6
+ selectedProduct: { type: String, default: "" }
7
+ });
8
+
9
+ const ProductModel = mongoose.model("Product", productSchema);
10
+
11
+ export default ProductModel;
@@ -0,0 +1,20 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const rationaleSchema = new mongoose.Schema({
4
+ affordabilityDescription: { type: String, default: "" },
5
+ affordabilityStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
6
+ applicantsDescription: { type: String, default: "" },
7
+ applicantsStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
8
+ creditConductDescription: { type: String, default: "" },
9
+ creditConductStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
10
+ fraudCheckDescription: { type: String, default: "" },
11
+ fraudCheckStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
12
+ incomeSourceDescription: { type: String, default: "" },
13
+ incomeSourceStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
14
+ loanDescription: { type: String, default: "" },
15
+ loanStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
16
+ securityDescription: { type: String, default: "" },
17
+ securityStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }
18
+ });
19
+ const RationaleModel = mongoose.model("Rationale", rationaleSchema);
20
+ export default RationaleModel;
@@ -0,0 +1,17 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const valuationSchema = new mongoose.Schema({
4
+ amount: { type: Number },
5
+ epcRating: { type: String, default: "" },
6
+ epcScore: { type: Number },
7
+ estimatedRentalValue: { type: Number },
8
+ instructionId: { type: String, default: "" },
9
+ instructionStatus: { type: String, default: "" },
10
+ instructionStatusComment: { type: String, default: "" },
11
+ isManual: { type: Boolean, default: false },
12
+ squareMetres: { type: Number },
13
+ valuerNotes: { type: String, default: "" },
14
+ version: { type: String, default: "" }
15
+ });
16
+ const ValuationModel = mongoose.model("Valuation", valuationSchema);
17
+ export default ValuationModel;
@@ -0,0 +1,69 @@
1
+ import mongoose from "mongoose";
2
+ import mortgageSchema from "./application-mortgage.model.js";
3
+
4
+ const applicationSchema = new mongoose.Schema(
5
+ {
6
+ queueID: [{
7
+ type: mongoose.Schema.Types.ObjectId,
8
+ ref: "Queue",
9
+ required: true,
10
+ }],
11
+ assignedToUserId: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
12
+ applicationId: { type: String, required: true },
13
+ isApplicationFeePaid: { type: Boolean, required: true },
14
+ applicationNumber: { type: String, required: true },
15
+ applicationTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
16
+ bankSolicitor: { type: String, default: "" },
17
+ brokerId: { type: mongoose.Schema.Types.ObjectId, ref: "Broker", required: true },
18
+ brokerName: { type: String }, // Broker name field added
19
+ caseManager: { type: String, default: "" },
20
+ caseManagerAccepted: { type: Boolean, default: false },
21
+ completedReason: { type: String, default: "" },
22
+ isIntendToOccupy: { type: Boolean, required: true },
23
+ introducer: { type: String, default: "" },
24
+ isIntroducerSubmission: { type: Boolean, required: true },
25
+ isBrokerAssigned: { type: Boolean, default: false },
26
+ isFinanceRecommendedToApplicant: { type: Boolean, required: true },
27
+ isWorkflowTaskCreated: { type: Boolean, required: true },
28
+ lastUpdated: { type: Date },
29
+ lendingTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
30
+ networkClubName: { type: String, default: "" },
31
+ isNetworkClubSubmission: { type: Boolean, required: true },
32
+ newReason: { type: String, default: "" },
33
+ purchaseTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
34
+ rejectedReason: { type: String, default: "" },
35
+ repaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
36
+ selectedProduct: { type: String, required: true },
37
+ sourceOfWealthLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
38
+ sowBusiness: { type: String, default: "" },
39
+ sowInheritance: { type: String, default: "" },
40
+ sowOther: { type: String, default: "" },
41
+ sowProperty: { type: String, default: "" },
42
+ sowSalary: { type: String, default: "" },
43
+ statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
44
+ submitReason: { type: String, default: "" },
45
+ submittedDate: { type: Date },
46
+ underwriter: { type: String, default: "" },
47
+ isValuationFeePaid: { type: Boolean, required: true },
48
+ withdrawalReason: { type: String, default: "" },
49
+ withdrawalReasonCode: { type: String, default: "" },
50
+ productId: { type: mongoose.Schema.Types.ObjectId, ref: "Product", required: true },
51
+ product: { type: String },
52
+ propertyId: { type: mongoose.Schema.Types.ObjectId, ref: "Property", required: true },
53
+ solicitorId: { type: mongoose.Schema.Types.ObjectId, ref: "Solicitor", required: true },
54
+ applicants: [
55
+ { type: mongoose.Schema.Types.ObjectId, ref: "Applicant" }
56
+ ],
57
+ statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
58
+ submittedDate: { type: Date },
59
+ isValuationFeePaid: { type: Boolean, required: true },
60
+ isActive: { type: Boolean, default: false },
61
+ isUkResident: { type: Boolean, default: true },
62
+ riskRating: { type: String },
63
+ mortgage: mortgageSchema
64
+ },
65
+ { timestamps: true }
66
+ );
67
+
68
+ const ApplicationModel = mongoose.model("Application", applicationSchema);
69
+ export default ApplicationModel;
@@ -0,0 +1,25 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const brokerSchema = new mongoose.Schema({
4
+ brokerID: { type: Number },
5
+ landlinePhone: { type: String },
6
+ mobileTelephone: { type: String },
7
+ addressPostCode: { type: String },
8
+ addressLine1: { type: String },
9
+ addressLine2: { type: String },
10
+ addressLine3: { type: String },
11
+ addressCity: { type: String },
12
+ addressCountry: { type: String },
13
+ tradingName: { type: String },
14
+ fcaNumber: { type: String },
15
+ brokerType: { type: String },
16
+ email: { type: String },
17
+ network: { type: String },
18
+ firstName: { type: String },
19
+ lastName: { type: String }
20
+ },
21
+ { timestamps: true });
22
+
23
+
24
+ const BrokerModel = mongoose.model("Broker", brokerSchema);
25
+ export default BrokerModel;
@@ -0,0 +1,37 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const documentSchema = new mongoose.Schema({
4
+ applicationId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: "Application",
7
+ required: false,
8
+ },
9
+ documentId: { type: String, required: true },
10
+ owningEntityId: { type: String, required: false },
11
+ documentTypeLid: {
12
+ type: mongoose.Schema.Types.ObjectId,
13
+ ref: "Lookup",
14
+ required: false,
15
+ },
16
+ documentTypeId: { type: Number, required: false },
17
+ fileName: { type: String, required: false },
18
+ contentType: { type: String, required: false },
19
+ created: { type: Date, required: false },
20
+ createdBy: { type: Number, required: false },
21
+ isGenerated: { type: Boolean, required: false },
22
+ data: { type: String, required: false },
23
+ envelopeId: { type: String, required: false },
24
+ signers: { type: Array, default: [] },
25
+ documentType: {
26
+ documentTypeId: { type: Number, required: false },
27
+ displayName: { type: String, required: false },
28
+ value: { type: String, required: false },
29
+ data: { type: Object, required: false },
30
+ },
31
+ documentUrl: { type: String, required: false },
32
+ }, {
33
+ timestamps: true
34
+ });
35
+
36
+ const DocumentModel = mongoose.model("Document", documentSchema);
37
+ export default DocumentModel;
@@ -0,0 +1,100 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const feeSchema = new mongoose.Schema({
4
+ feeType: { type: String, required: true },
5
+ description: { type: String, required: true },
6
+ feeAmount: { type: Number, required: true },
7
+ rate: { type: Number, default: 0 },
8
+ addedToLoan: { type: Boolean, default: false },
9
+ allowOverride: { type: Boolean, default: false },
10
+ additionalData: { type: mongoose.Schema.Types.Mixed, default: null }
11
+ });
12
+
13
+ const cashflowPeriodSchema = new mongoose.Schema({
14
+ from: { type: Number, default: null },
15
+ to: { type: Number, default: null },
16
+ instalmentAmount: { type: Number, default: null },
17
+ instalmentInterest: { type: Number, default: null },
18
+ instalmentCapitalRepaid: { type: Number, default: null },
19
+ otherCosts: { type: Number, default: 0 },
20
+ outstandingCapital: { type: Number, default: null }
21
+ });
22
+
23
+ const calculationsSchema = new mongoose.Schema({
24
+ ltv: { type: Number, default: null },
25
+ rentalCoverageRatioRate: { type: Number, default: null },
26
+ bankContributionRate: { type: Number, default: null },
27
+ bankInitialShareRate: { type: Number, default: null },
28
+ totalAmountPayable: { type: Number, default: null },
29
+ fixedMonthlyPayment: { type: Number, default: null },
30
+ fixedMonthlyCapital: { type: Number, default: null },
31
+ fixedMonthlyInterest: { type: Number, default: null },
32
+ variableMonthlyPayment: { type: Number, default: null },
33
+ summaryTotal: { type: Number, default: null },
34
+ reimbursementPerPound: { type: Number, default: null },
35
+ stressedPayment: { type: Number, default: null },
36
+ stressedPaymentRate: { type: Number, default: null },
37
+ rentalCoverage: { type: Number, default: null },
38
+ rentalCoverageWithoutTopUp: { type: Number, default: null }
39
+ });
40
+
41
+ const productFeaturesSchema = new mongoose.Schema({
42
+ name: { type: String, required: true },
43
+ clientAdvance: { type: Number, required: true },
44
+ ltv: { type: Number, required: true },
45
+ repayment: { type: Number, required: true },
46
+ variableRepayment: { type: Number, required: true },
47
+ reversionRateWithoutBaseRate: { type: Number, default: null },
48
+ totalReversionRate: { type: Number, default: null },
49
+ initialRate: { type: Number, required: true },
50
+ fixedTerm: { type: Number, required: true },
51
+ fixedTermEndDate: { type: Date, default: null },
52
+ baseRate: { type: Number, default: null },
53
+ productRate: { type: Number, default: null },
54
+ apr: { type: Number, default: null },
55
+ rentalCoverage: { type: Number, default: null },
56
+ repaymentType: { type: String, default: null },
57
+ applicationCategory: { type: String, default: null },
58
+ securityType: { type: String, default: null },
59
+ erc: { type: String, default: null },
60
+ loanType: { type: String, default: null },
61
+ maxLtvLimit: { type: String, default: null },
62
+ reimbursement: { type: Number, default: null },
63
+ reimbursementPerPound: { type: Number, default: null },
64
+ stressedApr: { type: Number, default: null },
65
+ stressedRate: { type: Number, default: null },
66
+ stressedRepayment: { type: Number, default: null },
67
+ liborFloorRate: { type: String, default: null },
68
+ totalTermInMonths: { type: Number, default: null },
69
+ chargeType: { type: String, default: '' },
70
+ productCategory: { type: String, default: '' },
71
+ ercCode: { type: String, default: '' },
72
+ variableTerm: { type: Number, default: null },
73
+ totalFeePayable: { type: Number, default: null },
74
+ dipIssueDate: { type: Date, default: null },
75
+ estimatedCompletionDate: { type: Date, default: null },
76
+ dipExpiryDate: { type: Date, default: null },
77
+ fixedRepaymentUntillDate: { type: Date, default: null },
78
+ rentalReviewDate: { type: Date, default: null },
79
+ totalReimbursementWithFee: { type: Number, default: null },
80
+ finalRentPayment: { type: Number, default: null },
81
+ clientDeposit: { type: Number, default: null },
82
+ firstRentPayment: { type: Number, default: null },
83
+ fees: [feeSchema],
84
+ ercFeatures: { type: mongoose.Schema.Types.Mixed, default: null },
85
+ cashflowPeriods: {
86
+ totalNoOfPayments: { type: Number, default: null },
87
+ fixed: cashflowPeriodSchema,
88
+ variable: cashflowPeriodSchema,
89
+ total: cashflowPeriodSchema
90
+ },
91
+ icr: { type: String, default: null },
92
+ ufssProductCode: { type: String, default: null },
93
+ ufssInterestRateCode: { type: String, default: null },
94
+ stressedPayment: { type: Number, default: null },
95
+ stressedPaymentRate: { type: Number, default: null },
96
+ calculations: calculationsSchema
97
+ });
98
+
99
+ const ProductFeaturesModel = mongoose.model("ProductFeatures", productFeaturesSchema);
100
+ export default ProductFeaturesModel;
@@ -0,0 +1,35 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const Schema = mongoose.Schema;
4
+
5
+ const solicitorSchema = new Schema({
6
+ dualRep: { type: Boolean, default: false },
7
+ isSraApprovedManagers: { type: Boolean, default: true },
8
+ pageValidFlag: { type: Boolean, default: true },
9
+ solicitorsList: { type: String},
10
+ useExistingSolicitor: { type: Boolean, default: true },
11
+ accountNumber: { type: String},
12
+ addressCity: { type: String},
13
+ addressCountryLID: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
14
+ addressLine1: { type: String, },
15
+ addressLine2: { type: String },
16
+ addressLine3: { type: String },
17
+ addressPostCode: { type: String, },
18
+ bankAddressLine1: { type: String, },
19
+ bankAddressLine2: { type: String },
20
+ bankBranch: { type: String, },
21
+ bankCity: { type: String, },
22
+ contactPostcode: { type: String, },
23
+ email: { type: String },
24
+ institution: { type: String },
25
+ isActive: { type: Boolean, default: true },
26
+ nameOfAccountHolder: { type: String },
27
+ nameOfFirm: { type: String},
28
+ signatory: { type: String},
29
+ solicitorActing: { type: String},
30
+ sortCode: { type: String, },
31
+ telephone: { type: String,},
32
+ });
33
+
34
+ const SolicitorModel = mongoose.model("Solicitor", solicitorSchema);
35
+ export default SolicitorModel;
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@dynamatix/gb-schemas",
3
+ "version": "0.0.2",
4
+ "description": "All the schemas for gatehouse bank back-end.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas.git"
12
+ },
13
+ "author": "Dynamatix",
14
+ "type": "module",
15
+ "license": "ISC",
16
+ "bugs": {
17
+ "url": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas/issues"
18
+ },
19
+ "homepage": "https://github.com/DynamatixAnalyticsPvtLtd/gb-schemas#readme",
20
+ "dependencies": {
21
+ "mongoose": "^8.9.5"
22
+ }
23
+ }
@@ -0,0 +1,99 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const dataStreetSchema = new mongoose.Schema({
4
+ floorArea: { type: String, default: '' },
5
+ propertyType: { type: String, default: '' },
6
+ noOfBedrooms: { type: Number, default: 0 },
7
+ noOfBathrooms: { type: Number, default: 0 },
8
+ lats: { type: String, },
9
+ longs: { type: String, },
10
+ lmkKey: { type: String, default: '' },
11
+ matchConfidence: { type: Number, default: 0 },
12
+ transactions:[{
13
+ transactionDate: String,
14
+ epc: String,
15
+ price: String,
16
+ isNewBuild: Boolean,
17
+ }],
18
+ nearByListings: [{
19
+ listedDate: String,
20
+ price: Number,
21
+ noOfBedrooms: Number,
22
+ noOfBathrooms: Number,
23
+ internalArea: String,
24
+ distance: String,
25
+ address: String,
26
+ propertyType: String
27
+ }],
28
+ nearByCompletedTransactions:[{
29
+ transactionDate: String,
30
+ price: Number,
31
+ noOfBedrooms: Number,
32
+ noOfBathrooms: Number,
33
+ internalArea: String,
34
+ distance: String,
35
+ address: String,
36
+ }],
37
+ risk: {
38
+ conservationArea: String,
39
+ listedBuildingsOnPlot: String,
40
+ nearByListedBuildings: [{
41
+ name: String,
42
+ listedDate: String,
43
+ grade: String,
44
+ disatanceInMetres: String
45
+ }],
46
+ floodRisk: {
47
+ riverAndSeaRisk: String,
48
+ surfaceWaterRisk: String,
49
+ }
50
+ }
51
+ });
52
+
53
+ const propertySchema = new mongoose.Schema({
54
+ haveAnyBuyToLetProperties: { type: Boolean, required: true },
55
+ isPropertyInEnglandOrWales: { type: Boolean, required: true },
56
+ price: { type: String, default: '' },
57
+ noOfBuyToLetProperties: { type: Number },
58
+ totalMonthlyRentalIncome: { type: String, default: '' },
59
+ totalMonthlyRepayment: { type: String, default: '' },
60
+ totalOutstandingBalance: { type: String, default: '' },
61
+ areAllBedRoomsOver10sqm: { type: Boolean, required: true },
62
+ isBrickTileConstruction: { type: Boolean, required: true },
63
+ constructionDetails: { type: String, default: '' },
64
+ isExLAExclusion: { type: Boolean, required: true },
65
+ isFlatLift: { type: Boolean, required: true },
66
+ flatNumberOfBedrooms: { type: Number},
67
+ isGreenEPC: { type: Boolean, required: true },
68
+ isGroundRent: { type: String, default: '' },
69
+ isHouseLicensed: { type: Boolean, required: true },
70
+ houseNumberOfFloors: { type: Number },
71
+ houseNumberOfKitchens: { type: Number },
72
+ houseNumberOfLivingRooms: { type: Number },
73
+ houseNumberOfBathrooms: { type: Number },
74
+ houseNumberOfTenancies: { type: Number },
75
+ hasHousePlanningPermission: { type: Boolean, required: true },
76
+ isGarage: { type: Boolean, required: true },
77
+ isNewBuild: { type: Boolean, required: true },
78
+ propertyAddressCity: { type: String, required: true },
79
+ propertyAddressCountry: { type: String, required: true },
80
+ propertyAddressLine1: { type: String, required: true },
81
+ propertyAddressLine2: { type: String, default: '' },
82
+ propertyAddressLine3: { type: String, default: '' },
83
+ propertyAddressPostCode: { type: String, required: true },
84
+ propertyTenureLID: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
85
+ propertyTypeLID: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
86
+ propertyYearBuilt: { type: Number },
87
+ receiptOfAnyDiscount: { type: Boolean, },
88
+ receiptOfDiscountDetails: { type: String, default: '' },
89
+ sectorExperience: { type: String, required: true },
90
+ serviceCharge: { type: String, default: '' },
91
+ unexpiredRemainingLease: { type: String, default: '' },
92
+ yearLeaseExpires: { type: String, default: '' },
93
+ energyEfficiencyRating: { type: String},
94
+ energyEfficiencyRatingValue: { type: Number },
95
+ dataStreetSchema: dataStreetSchema,
96
+ });
97
+
98
+ const PropertyModel = mongoose.model("Property", propertySchema);
99
+ export default PropertyModel;
@@ -0,0 +1,17 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const lookupGroupSchema = new mongoose.Schema({
4
+ name: {
5
+ type: String,
6
+ required: true
7
+ },
8
+ lookups: [
9
+ {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: "Lookup", // References the Lookup collection
12
+ },
13
+ ],
14
+ });
15
+
16
+ const LookupGroupModel = mongoose.model('LookupGroup', lookupGroupSchema);
17
+ export default LookupGroupModel;
@@ -0,0 +1,22 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const lookupSchema = new mongoose.Schema({
4
+ name: {
5
+ type: String,
6
+ required: true
7
+ },
8
+ text: {
9
+ type: String,
10
+ required: true
11
+ },
12
+ lookupGroupID:{
13
+ type: mongoose.Schema.Types.ObjectId,
14
+ ref: "LookupGroup", // References the LookupGroup collection
15
+ },
16
+ value: {
17
+ type: String
18
+ }
19
+ });
20
+
21
+ const LookupModel = mongoose.model('Lookup', lookupSchema);
22
+ export default LookupModel;
@@ -0,0 +1,34 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const systemParameterSchema = new mongoose.Schema({
4
+ parameterName: {
5
+ type: String,
6
+ required: true,
7
+ },
8
+ parameterValue: {
9
+ type: mongoose.Schema.Types.Mixed,
10
+ required: true,
11
+ },
12
+ notes: {
13
+ type: String,
14
+ },
15
+ createdByUserId: {
16
+ type: mongoose.Schema.Types.ObjectId,
17
+ ref: 'User',
18
+ required: true,
19
+ },
20
+ createdOn: {
21
+ type: Date,
22
+ default: Date.now,
23
+ },
24
+ updatedByUserId: {
25
+ type: mongoose.Schema.Types.ObjectId,
26
+ ref: 'User',
27
+ },
28
+ updatedOn: {
29
+ type: Date,
30
+ },
31
+ });
32
+
33
+ const SystemParameterModel = mongoose.model('SystemParameter', systemParameterSchema);
34
+ export default SystemParameterModel;
@@ -0,0 +1,16 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const RoleGroupSchema = new mongoose.Schema({
4
+ groupId: { type: Number, required: true },
5
+ name: { type: String, required: true },
6
+ description: { type: String },
7
+ roles: [{
8
+ type: mongoose.Schema.Types.ObjectId,
9
+ ref: 'Role'
10
+ }]
11
+ },{
12
+ timestamps: true
13
+ });
14
+
15
+ const RoleGroupModel = mongoose.model('RoleGroup', RoleGroupSchema);
16
+ export default RoleGroupModel;
@@ -0,0 +1,14 @@
1
+ import mongoose from "mongoose";
2
+
3
+ const RoleSchema = new mongoose.Schema({
4
+ roleId: { type: Number, required: true },
5
+ name: { type: String, required: true },
6
+ description: { type: String }
7
+ },{
8
+ timestamps: true
9
+ });
10
+
11
+
12
+ const RoleModel = mongoose.model('Role', RoleSchema);
13
+
14
+ export default RoleModel;