@dynamatix/gb-schemas 2.0.27 → 2.0.28

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 (96) hide show
  1. package/dist/applicants/applicant-additional-income.model.d.ts +21 -927
  2. package/dist/applicants/applicant-additional-income.model.d.ts.map +1 -1
  3. package/dist/applicants/applicant-additional-income.model.js +3 -23
  4. package/dist/applicants/applicant-commitment-creditCard.model.d.ts +6 -0
  5. package/dist/applicants/applicant-commitment-creditCard.model.d.ts.map +1 -1
  6. package/dist/applicants/applicant-commitment-creditCard.model.js +1 -0
  7. package/dist/applicants/applicant-commitment-loan.model.d.ts +6 -0
  8. package/dist/applicants/applicant-commitment-loan.model.d.ts.map +1 -1
  9. package/dist/applicants/applicant-commitment-loan.model.js +1 -0
  10. package/dist/applicants/applicant-commitment-mortgage.model.d.ts +6 -0
  11. package/dist/applicants/applicant-commitment-mortgage.model.d.ts.map +1 -1
  12. package/dist/applicants/applicant-commitment-mortgage.model.js +1 -0
  13. package/dist/applicants/applicant-employment.model.d.ts +1234 -6
  14. package/dist/applicants/applicant-employment.model.d.ts.map +1 -1
  15. package/dist/applicants/applicant-income-settings.model.d.ts +81 -0
  16. package/dist/applicants/applicant-income-settings.model.d.ts.map +1 -0
  17. package/dist/applicants/applicant-income-settings.model.js +11 -0
  18. package/dist/applicants/applicant-income.model.d.ts +0 -12
  19. package/dist/applicants/applicant-income.model.d.ts.map +1 -1
  20. package/dist/applicants/applicant-pension-income.model.d.ts +288 -0
  21. package/dist/applicants/applicant-pension-income.model.d.ts.map +1 -1
  22. package/dist/applicants/applicant-pension-income.model.js +13 -0
  23. package/dist/applicants/applicant-uk-tax-credits.model.d.ts +288 -0
  24. package/dist/applicants/applicant-uk-tax-credits.model.d.ts.map +1 -1
  25. package/dist/applicants/applicant-uk-tax-credits.model.js +2 -0
  26. package/dist/applicants/applicant.model.d.ts +0 -1
  27. package/dist/applicants/applicant.model.d.ts.map +1 -1
  28. package/dist/applicants/index.d.ts +2 -0
  29. package/dist/applicants/index.d.ts.map +1 -1
  30. package/dist/index.d.ts +0 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/entities/applicants/applicant.entity.ts +3 -3
  33. package/package.json +1 -1
  34. package/prisma/applicants/applicant.prisma +3 -3
  35. package/prisma/migrations/20250509073536_update_applicant_schema/migration.sql +4 -0
  36. package/prisma/schema.prisma +3 -3
  37. package/dist/applicants/applicant-credit-data.model.js +0 -11
  38. package/dist/applicants/applicant-credit-profile.model.js +0 -20
  39. package/dist/applicants/applicant-direct-debit.model.js +0 -17
  40. package/dist/applicants/applicant-employment.model.js +0 -50
  41. package/dist/applicants/applicant-expenditure.model.js +0 -54
  42. package/dist/applicants/applicant-income-source.model.js +0 -9
  43. package/dist/applicants/applicant-income.model.js +0 -81
  44. package/dist/applicants/applicant-risk-narrative.model.js +0 -13
  45. package/dist/applicants/applicant.model.js +0 -223
  46. package/dist/applicants/index.js +0 -13
  47. package/dist/applications/application-audit.model.js +0 -42
  48. package/dist/applications/application-checklist-Item.model.js +0 -45
  49. package/dist/applications/application-company-model.js +0 -120
  50. package/dist/applications/application-credit-profile.model.js +0 -12
  51. package/dist/applications/application-direct-debit.model.js +0 -92
  52. package/dist/applications/application-document.model.js +0 -35
  53. package/dist/applications/application-fieldconfig.model.js +0 -7
  54. package/dist/applications/application-illustration-model.js +0 -6
  55. package/dist/applications/application-legal.model.js +0 -7
  56. package/dist/applications/application-mortgage.model.js +0 -271
  57. package/dist/applications/application-note.model.js +0 -78
  58. package/dist/applications/application-offer.model.js +0 -6
  59. package/dist/applications/application-onboarding.model.js +0 -9
  60. package/dist/applications/application-product.model.js +0 -67
  61. package/dist/applications/application-rationale.model.js +0 -38
  62. package/dist/applications/application-risk-narrative.model.js +0 -12
  63. package/dist/applications/application-valuation.model.js +0 -15
  64. package/dist/applications/application.model.js +0 -153
  65. package/dist/applications/broker.model.js +0 -21
  66. package/dist/applications/document.model.js +0 -35
  67. package/dist/applications/index.js +0 -20
  68. package/dist/applications/solicitor.model.js +0 -114
  69. package/dist/index.js +0 -9
  70. package/dist/product-catalogues/index.js +0 -3
  71. package/dist/product-catalogues/product-catalogue.model.js +0 -18
  72. package/dist/product-catalogues/product-definitions.model.js +0 -26
  73. package/dist/product-catalogues/product-variant.model.js +0 -12
  74. package/dist/properties/index.js +0 -2
  75. package/dist/properties/property.model.js +0 -144
  76. package/dist/shared/alert.model.js +0 -24
  77. package/dist/shared/apprivo-sync-journey.model.js +0 -17
  78. package/dist/shared/checklist.model.js +0 -30
  79. package/dist/shared/document-type-model.js +0 -10
  80. package/dist/shared/index.js +0 -12
  81. package/dist/shared/job-run.model.js +0 -14
  82. package/dist/shared/job-setting.model.js +0 -11
  83. package/dist/shared/lookup-group.model.js +0 -16
  84. package/dist/shared/lookup.model.js +0 -20
  85. package/dist/shared/system-parameter.model.js +0 -32
  86. package/dist/shared/task-document.model.js +0 -23
  87. package/dist/shared/task.model.js +0 -15
  88. package/dist/underwriter/index.js +0 -1
  89. package/dist/underwriter/underwriter.model.js +0 -17
  90. package/dist/users/auth-log.model.js +0 -21
  91. package/dist/users/index.js +0 -6
  92. package/dist/users/permission.model.js +0 -10
  93. package/dist/users/role-group.model.js +0 -14
  94. package/dist/users/role.model.js +0 -13
  95. package/dist/users/tasks.model.js +0 -15
  96. package/dist/users/user.model.js +0 -30
@@ -1,153 +0,0 @@
1
- import mongoose from "mongoose";
2
- import creditProfileSchema from "./application-credit-profile.model";
3
- const applicationSchema = new mongoose.Schema({
4
- queueId: [{
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: "Queue",
7
- required: true,
8
- }],
9
- assignedToUserId: { type: mongoose.Schema.Types.ObjectId, ref: "User" },
10
- applicationId: { type: String, required: true },
11
- isApplicationFeePaid: { type: String, required: true },
12
- applicationNumber: { type: String, required: true },
13
- applicationTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
14
- bankSolicitor: { type: String, default: "" },
15
- brokerId: { type: mongoose.Schema.Types.ObjectId, ref: "Broker", required: true },
16
- caseManager: { type: String, default: "" },
17
- caseManagerAccepted: { type: String, default: false },
18
- completedReason: { type: String, default: "" },
19
- isIntendToOccupy: { type: String, required: true },
20
- introducer: { type: String, default: "" },
21
- isIntroducerSubmission: { type: String, required: true },
22
- isBrokerAssigned: { type: String, default: false },
23
- isFinanceRecommendedToApplicant: { type: String, required: true },
24
- isWorkflowTaskCreated: { type: String, required: true },
25
- lastUpdated: { type: String },
26
- lendingTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
27
- networkClubName: { type: String, default: "" },
28
- isNetworkClubSubmission: { type: String, required: true },
29
- newReason: { type: String, default: "" },
30
- purchaseTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
31
- rejectedReason: { type: String, default: "" },
32
- repaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
33
- selectedProduct: { type: String, required: false },
34
- sourceOfWealthLids: [{ type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }],
35
- sowBusiness: { type: String, default: "" },
36
- sowInheritance: { type: String, default: "" },
37
- sowOther: { type: String, default: "" },
38
- sowProperty: { type: String, default: "" },
39
- sowSalary: { type: String, default: "" },
40
- statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
41
- submitReason: { type: String, default: "" },
42
- submittedDate: { type: String },
43
- underwriter: { type: String, default: "" },
44
- isValuationFeePaid: { type: String, required: true },
45
- withdrawalReason: { type: String, default: "" },
46
- withdrawalReasonCode: { type: String, default: "" },
47
- productId: { type: mongoose.Schema.Types.ObjectId, ref: "Product", required: false },
48
- product: { type: String },
49
- securityId: { type: mongoose.Schema.Types.ObjectId, ref: "Security", required: true },
50
- solicitorId: { type: mongoose.Schema.Types.ObjectId, ref: "Solicitor", required: true },
51
- applicants: [
52
- { type: mongoose.Schema.Types.ObjectId, ref: "Applicant" }
53
- ],
54
- isActive: { type: String, default: false },
55
- isUkResident: { type: String, default: true },
56
- riskRating: { type: String },
57
- directDebitId: { type: mongoose.Schema.Types.ObjectId, ref: "Application_DirectDebit" },
58
- creditProfile: creditProfileSchema,
59
- mortgageId: { type: mongoose.Schema.Types.ObjectId, ref: "Mortgage" },
60
- companyId: { type: mongoose.Schema.Types.ObjectId, ref: "ApplicationCompany" },
61
- rationaleId: { type: mongoose.Schema.Types.ObjectId, ref: "ApplicationRationale" },
62
- newAuditRecordsCount: { type: String, default: 0 }, // Ensure it is a Number
63
- currentApprivoAuditId: Number,
64
- propertyIds: [{ type: mongoose.Schema.Types.ObjectId, ref: "Property" }]
65
- }, {
66
- timestamps: true,
67
- toJSON: { virtuals: true },
68
- toObject: { virtuals: true }
69
- });
70
- // Virtual property 'noOfApplicants'
71
- applicationSchema.virtual('noOfApplicants').get(function () {
72
- return this.applicants ? this.applicants.length : 0;
73
- });
74
- // Virtual property 'applicationTypeName'
75
- applicationSchema.virtual('applicationTypeName').get(function () {
76
- return this.applicationTypeLid instanceof mongoose.Types.ObjectId
77
- ? null
78
- : this.applicationTypeLid?.name ?? null;
79
- });
80
- // Virtual property 'lendingType'
81
- applicationSchema.virtual('lendingType').get(function () {
82
- return this.lendingTypeLid instanceof mongoose.Types.ObjectId
83
- ? null
84
- : this.lendingTypeLid?.name ?? null;
85
- });
86
- // Virtual property 'purchaseType'
87
- applicationSchema.virtual('purchaseType').get(function () {
88
- return this.purchaseTypeLid instanceof mongoose.Types.ObjectId
89
- ? null
90
- : this.purchaseTypeLid?.text ?? null;
91
- });
92
- // Virtual property 'status'
93
- applicationSchema.virtual('status').get(function () {
94
- return this.statusLid instanceof mongoose.Types.ObjectId ? null : this.statusLid?.name ?? null;
95
- });
96
- // Ensure the fields are populated when querying
97
- applicationSchema.pre('find', function () {
98
- this.populate('applicationTypeLid').populate('lendingTypeLid').populate('statusLid');
99
- });
100
- applicationSchema.pre('findOne', function () {
101
- this.populate('applicationTypeLid').populate('lendingTypeLid').populate('statusLid');
102
- });
103
- // Virtual property 'LTV %'
104
- applicationSchema.virtual('ltv').get(function () {
105
- const purchasePrice = this.mortgageId?.purchasePrice;
106
- const loanRequired = this.mortgageId?.loanRequired;
107
- if (purchasePrice && loanRequired) {
108
- const parseCurrency = (value) => {
109
- if (typeof value === 'string') {
110
- return parseFloat(value.replace(/[^0-9.-]+/g, ""));
111
- }
112
- return value;
113
- };
114
- const parsedPurchasePrice = parseCurrency(purchasePrice);
115
- const parsedLoanRequired = parseCurrency(loanRequired);
116
- const ltv = (parsedLoanRequired / parsedPurchasePrice) * 100;
117
- return ltv.toFixed(2) + "%";
118
- }
119
- return null;
120
- });
121
- applicationSchema.virtual('submittedDateFormatted').get(function () {
122
- if (!this.submittedDate)
123
- return null;
124
- const date = new Date(this.submittedDate);
125
- const day = String(date.getDate()).padStart(2, '0');
126
- const month = String(date.getMonth() + 1).padStart(2, '0');
127
- const year = date.getFullYear();
128
- return `${day}-${month}-${year}`;
129
- });
130
- // Virtual property for broker name
131
- applicationSchema.virtual('brokerName').get(function () {
132
- if (this.brokerId && typeof this.brokerId === 'object' && this.brokerId.firstName && this.brokerId.lastName) {
133
- return this.brokerId.firstName + " " + this.brokerId.lastName;
134
- }
135
- return null;
136
- });
137
- applicationSchema.virtual('brokerEmail').get(function () {
138
- return this.brokerId && typeof this.brokerId === 'object' ? this.brokerId.email : null;
139
- });
140
- applicationSchema.virtual('solicitorName').get(function () {
141
- return this.solicitorId && typeof this.solicitorId === 'object' ? this.solicitorId.nameOfAccountHolder : null;
142
- });
143
- applicationSchema.virtual('solicitorEmail').get(function () {
144
- return this.solicitorId && typeof this.solicitorId === 'object' ? this.solicitorId.email : null;
145
- });
146
- applicationSchema.virtual('brokerPhone').get(function () {
147
- return this.brokerId && typeof this.brokerId === 'object' ? this.brokerId.mobileTelephone : null;
148
- });
149
- applicationSchema.virtual('solicitorPhone').get(function () {
150
- return this.solicitorId && typeof this.solicitorId === 'object' ? this.solicitorId.telephone : null;
151
- });
152
- const ApplicationModel = mongoose.model("Application", applicationSchema);
153
- export default ApplicationModel;
@@ -1,21 +0,0 @@
1
- import mongoose from "mongoose";
2
- const brokerSchema = new mongoose.Schema({
3
- brokerId: { type: String },
4
- landlinePhone: { type: String },
5
- mobileTelephone: { type: String },
6
- addressPostCode: { type: String },
7
- addressLine1: { type: String },
8
- addressLine2: { type: String },
9
- addressLine3: { type: String },
10
- addressCity: { type: String },
11
- addressCountry: { type: String },
12
- tradingName: { type: String },
13
- fcaNumber: { type: String },
14
- brokerType: { type: String },
15
- email: { type: String },
16
- network: { type: String },
17
- firstName: { type: String },
18
- lastName: { type: String }
19
- }, { timestamps: true });
20
- const BrokerModel = mongoose.model("Broker", brokerSchema);
21
- export default BrokerModel;
@@ -1,35 +0,0 @@
1
- import mongoose from "mongoose";
2
- const documentSchema = new mongoose.Schema({
3
- applicationId: {
4
- type: mongoose.Schema.Types.ObjectId,
5
- ref: "Application",
6
- required: false,
7
- },
8
- documentId: { type: String, required: true },
9
- owningEntityId: { type: String, required: false },
10
- documentTypeLid: {
11
- type: mongoose.Schema.Types.ObjectId,
12
- ref: "Lookup",
13
- required: false,
14
- },
15
- documentTypeId: { type: mongoose.Schema.Types.ObjectId, ref: "DocumentType", required: false },
16
- fileName: { type: String, required: false },
17
- contentType: { type: String, required: false },
18
- created: { type: String, required: false },
19
- createdBy: { type: String, required: false },
20
- isGenerated: { type: String, required: false },
21
- data: { type: String, required: false },
22
- envelopeId: { type: String, required: false },
23
- signers: { type: Array, default: [] },
24
- documentType: {
25
- documentTypeId: { type: String, required: false },
26
- displayName: { type: String, required: false },
27
- value: { type: String, required: false },
28
- data: { type: Object, required: false },
29
- },
30
- documentUrl: { type: String, required: false },
31
- }, {
32
- timestamps: true
33
- });
34
- const DocumentModel = mongoose.model("Document", documentSchema);
35
- export default DocumentModel;
@@ -1,20 +0,0 @@
1
- export { default as ApplicationModel } from './application.model';
2
- export { default as ApplicationAuditModel } from './application-audit.model';
3
- export { default as ApplicationCheckListModel } from './application-checklist-Item.model';
4
- export { default as ApplicationCompanyModel } from './application-company-model.js';
5
- export { default as ApplicationNoteModel } from './application-note.model';
6
- export { default as ApplicationCreditProfileModel } from './application-credit-profile.model';
7
- export { default as ApplicationDirectDebitModel } from './application-direct-debit.model';
8
- export { default as ApplicationMortgageModel } from './application-mortgage.model';
9
- export { default as ApplicationOnboardingModel } from './application-onboarding.model';
10
- export { default as ApplicationRationaleModel } from './application-rationale.model';
11
- export { default as ApplicationValuationModel } from './application-valuation.model';
12
- export { default as BrokerModel } from './broker.model';
13
- export { default as ProductModel } from './application-product.model';
14
- export { default as SolicitorModel } from './solicitor.model';
15
- export { default as ApplicationDocumentModel } from './application-document.model';
16
- export { default as ApplicationRiskNarrativeModel } from './application-risk-narrative.model';
17
- export { default as ApplicationFieldConfigModel } from './application-fieldconfig.model';
18
- export { default as DocumentModel } from './document.model';
19
- export { default as MortgageModel } from './application-mortgage.model';
20
- export { default as ApplicationProductFeaturesModel } from './application-productfeatures.model';
@@ -1,114 +0,0 @@
1
- import mongoose from "mongoose";
2
- import { SortCode } from "../value-objects/sort-code";
3
- const Schema = mongoose.Schema;
4
- const solicitorSchema = new Schema({
5
- applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application",
6
- required: true,
7
- description: "Unique identifier for the application",
8
- },
9
- pageValidFlag: {
10
- type: Boolean,
11
- default: true,
12
- },
13
- accountNumber: {
14
- type: Number,
15
- description: "Account number associated with the solicitor"
16
- },
17
- addressCity: {
18
- type: String,
19
- maxLength: 30,
20
- description: "City where the solicitor is located"
21
- },
22
- addressCountryLid: {
23
- type: mongoose.Schema.Types.ObjectId,
24
- ref: "Lookup",
25
- description: "Country ID from the lookup list"
26
- },
27
- addressLine1: {
28
- type: String,
29
- maxLength: 35,
30
- description: "First line of the solicitor's address"
31
- },
32
- addressLine2: {
33
- type: String,
34
- maxLength: 35,
35
- description: "Second line of the solicitor's address"
36
- },
37
- addressLine3: {
38
- type: String,
39
- maxLength: 35,
40
- description: "Third line of the solicitor's address"
41
- },
42
- addressPostCode: {
43
- type: String,
44
- maxLength: 50,
45
- description: "Postal code for the solicitor's address"
46
- },
47
- bankAddressLine1: {
48
- type: String,
49
- description: "First line of the solicitor's bank address"
50
- },
51
- bankAddressLine2: {
52
- type: String,
53
- description: "Second line of the solicitor's bank address"
54
- },
55
- bankBranch: {
56
- type: String,
57
- description: "Branch of the solicitor's bank"
58
- },
59
- bankCity: {
60
- type: String,
61
- description: "City where the solicitor's bank is located"
62
- },
63
- contactPostcode: {
64
- type: String,
65
- description: "Postal code for the solicitor's contact address"
66
- },
67
- email: {
68
- type: String,
69
- description: "Email address of the solicitor"
70
- },
71
- institution: {
72
- type: String,
73
- description: "Institution name where the solicitor works"
74
- },
75
- nameOfAccountHolder: {
76
- type: String,
77
- description: "Name of the account holder associated with the solicitor"
78
- },
79
- nameOfFirm: {
80
- type: String,
81
- description: "Name of the solicitor's firm"
82
- },
83
- signatory: {
84
- type: String,
85
- description: "Signatory name for the solicitor"
86
- },
87
- solicitorActing: {
88
- type: String,
89
- maxLength: 50,
90
- description: "Indicates if the solicitor is acting in a particular capacity"
91
- },
92
- sortCode: {
93
- type: SortCode,
94
- description: "Sort code associated with the solicitor's account"
95
- },
96
- telephone: {
97
- type: String,
98
- maxLength: 15,
99
- description: "Telephone number of the solicitor"
100
- },
101
- }, {
102
- timestamps: true,
103
- toJSON: { virtuals: true },
104
- toObject: { virtuals: true }
105
- });
106
- const virtualCountry = solicitorSchema.virtual('addressCountry', {
107
- ref: 'Lookup',
108
- localField: 'addressCountryLid',
109
- foreignField: '_id',
110
- justOne: true
111
- });
112
- virtualCountry.description = 'Populated lookup value for the solicitor\'s address country';
113
- const SolicitorModel = mongoose.model("Solicitor", solicitorSchema);
114
- export default SolicitorModel;
package/dist/index.js DELETED
@@ -1,9 +0,0 @@
1
- export * from './applications/index.js';
2
- export * from './shared/index.js';
3
- export * from './properties/index.js';
4
- export * from './applicants/index.js';
5
- export * from './users/index.js';
6
- export * from './product-catalogues/index.js';
7
- export * from './underwriter/index.js';
8
- // Export Prisma/Postgres schemas
9
- export * from './entities/index.js';
@@ -1,3 +0,0 @@
1
- export { default as ProductCatalogueModel } from './product-catalogue.model';
2
- export { default as ProductDefinitionsModel } from './product-definitions.model';
3
- export { default as ProductVariantModel } from './product-variant.model';
@@ -1,18 +0,0 @@
1
- import mongoose from "mongoose";
2
- const productCatalogueSchema = new mongoose.Schema({
3
- productCatalogueId: { type: String, required: true },
4
- name: { type: String, required: true },
5
- description: { type: String },
6
- applyFrom: { type: String, required: true },
7
- applyUntil: { type: String, required: true },
8
- submitUntil: { type: String, required: true },
9
- status: { type: String, required: true },
10
- lockedForEdit: { type: String, required: true },
11
- baseRateName: { type: String },
12
- baseRate: { type: String },
13
- mapperName: { type: String }
14
- }, {
15
- timestamps: true
16
- });
17
- const ProductCatalogueModel = mongoose.model('ProductCatalogue', productCatalogueSchema);
18
- export default ProductCatalogueModel;
@@ -1,26 +0,0 @@
1
- import mongoose from "mongoose";
2
- const ruleSchema = new mongoose.Schema({
3
- ruleId: { type: String, required: true },
4
- rule: { type: String, required: true }, // Storing as a string (JSON stringified)
5
- name: { type: String, required: true },
6
- description: { type: String },
7
- scope: { type: String },
8
- mandatory: { type: String, required: true },
9
- overrideRuleType: { type: String },
10
- overrideRuleMessage: { type: String },
11
- inheritedFrom: { type: String },
12
- anyPass: { type: String, required: true },
13
- preCashflow: { type: String, required: true }
14
- });
15
- const productDefinitionsSchema = new mongoose.Schema({
16
- productDefinitionId: { type: String, required: true },
17
- productCatalogueId: { ref: "ProductCatalogue", type: mongoose.Schema.Types.ObjectId, required: true },
18
- name: { type: String, required: true },
19
- atLeastOnePass: { type: String, required: true },
20
- elements: { type: [mongoose.Schema.Types.Mixed], default: [] },
21
- rules: { type: [ruleSchema], default: [] } // Embedded array of RuleSchema
22
- }, {
23
- timestamps: true
24
- });
25
- const ProductDefinitionsModel = mongoose.model('ProductDefinitions', productDefinitionsSchema);
26
- export default ProductDefinitionsModel;
@@ -1,12 +0,0 @@
1
- import mongoose from "mongoose";
2
- const productVariantSchema = new mongoose.Schema({
3
- productCatalogueId: { ref: "ProductCatalogue", type: mongoose.Schema.Types.ObjectId, required: true },
4
- variantid: { type: String, required: true },
5
- name: { type: String, required: true },
6
- variantCode: { type: String, required: true },
7
- label: { type: String },
8
- }, {
9
- timestamps: true
10
- });
11
- const ProductVariantModel = mongoose.model('ProductVariant', productVariantSchema);
12
- export default ProductVariantModel;
@@ -1,2 +0,0 @@
1
- export { default as SecurityModel } from './security.model';
2
- export { default as PropertyModel } from './property.model';
@@ -1,144 +0,0 @@
1
- import mongoose from 'mongoose';
2
- import { Pound } from '../value-objects/pound';
3
- const propertySchema = new mongoose.Schema({
4
- applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application",
5
- description: "Unique identifier for the application",
6
- required: true
7
- },
8
- pageValidFlag: {
9
- type: Boolean,
10
- default: true,
11
- description: "Flag indicating if the page is valid",
12
- },
13
- propertyId: {
14
- type: String,
15
- required: true,
16
- unique: true,
17
- description: "Unique identifier for the property"
18
- },
19
- addressLine1: {
20
- type: String,
21
- required: true,
22
- maxLength: 35,
23
- description: "First line of the property address"
24
- },
25
- addressLine2: {
26
- type: String,
27
- required: false,
28
- maxLength: 35,
29
- description: "Second line of the property address"
30
- },
31
- addressLine3: {
32
- type: String,
33
- required: false,
34
- maxLength: 35,
35
- description: "Third line of the property address"
36
- },
37
- associatedLoanPartiesIds: {
38
- type: [mongoose.Schema.Types.ObjectId],
39
- required: false,
40
- description: "List of associated loan parties (either applicant or company)"
41
- },
42
- city: {
43
- type: String,
44
- required: false,
45
- maxLength: 30,
46
- description: "City where the property is located"
47
- },
48
- countryLid: {
49
- type: mongoose.Schema.Types.ObjectId,
50
- ref: 'Lookup',
51
- required: true,
52
- description: "Country where the property is located",
53
- },
54
- lender: {
55
- type: String,
56
- required: true,
57
- maxLength: 35,
58
- description: "Lender providing the loan for the property"
59
- },
60
- marketValue: {
61
- type: Pound,
62
- required: true,
63
- default: 0.00,
64
- description: "The market value of the property",
65
- },
66
- monthlyRent: {
67
- type: Pound,
68
- required: true,
69
- default: 0.00,
70
- description: "The monthly rent value of the property"
71
- },
72
- monthlyRepayment: {
73
- type: Pound,
74
- required: true,
75
- default: 0.00,
76
- description: "The monthly repayment value for the property"
77
- },
78
- originalLoanBalance: {
79
- type: Pound,
80
- required: true,
81
- default: 0.00,
82
- description: "The original loan balance for the property"
83
- },
84
- outstandingBalance: {
85
- type: Pound,
86
- required: true,
87
- default: 0.00,
88
- description: "The remaining outstanding balance of the property loan"
89
- },
90
- otherOwnershipParties: {
91
- type: String,
92
- required: false,
93
- maxLength: 500,
94
- description: "Other parties that own the property"
95
- },
96
- postCode: {
97
- type: String,
98
- required: true,
99
- maxLength: 50,
100
- description: "The postCode for the property"
101
- },
102
- remainingTerm: {
103
- type: Number,
104
- required: true,
105
- max: 4,
106
- description: "The remaining term of the loan in years"
107
- },
108
- portfolioFile: {
109
- type: String,
110
- required: false,
111
- description: "File containing the portfolio details"
112
- }
113
- }, {
114
- timestamps: true,
115
- toJSON: { virtuals: true },
116
- toObject: { virtuals: true }
117
- });
118
- propertySchema.virtual('country').get(function () {
119
- return this.countryLid instanceof mongoose.Types.ObjectId ? null : this.countryLid?.name || null;
120
- });
121
- propertySchema.virtual('stressedRCR').get(function () {
122
- const monthlyRentValue = this.monthlyRent ? parseFloat(this.monthlyRent.toString()) : 0.00;
123
- const monthlyRepaymentValue = this.monthlyRepayment ? parseFloat(this.monthlyRepayment.toString()) : 0.00;
124
- // Avoid division by zero
125
- if (monthlyRepaymentValue === 0) {
126
- return '0.00'; // Return 0.00 if monthlyRepayment is zero
127
- }
128
- const stressedRCR = (monthlyRentValue / monthlyRepaymentValue) * 100;
129
- return stressedRCR.toFixed(2);
130
- });
131
- // virtual property 'applicationType'
132
- propertySchema.virtual('applicationType').get(function () {
133
- return this.applicationId?.applicationTypeLid instanceof mongoose.Types.ObjectId
134
- ? null
135
- : this.applicationId?.applicationTypeLid?.name || null;
136
- });
137
- // virtual property 'lendingType'
138
- propertySchema.virtual('lendingType').get(function () {
139
- return this.applicationId?.lendingTypeLid instanceof mongoose.Types.ObjectId
140
- ? null
141
- : this.applicationId?.lendingTypeLid?.name || null;
142
- });
143
- const PropertyModel = mongoose.model('Property', propertySchema);
144
- export default PropertyModel;
@@ -1,24 +0,0 @@
1
- import mongoose from "mongoose";
2
- const alertSchema = new mongoose.Schema({
3
- alertTypeLid: {
4
- type: mongoose.Schema.Types.ObjectId,
5
- ref: "Lookup"
6
- },
7
- applicationId: {
8
- type: mongoose.Schema.Types.ObjectId,
9
- ref: "Application",
10
- required: true
11
- },
12
- alertMessage: { type: String },
13
- documentId: {
14
- type: mongoose.Schema.Types.ObjectId,
15
- ref: "Document",
16
- },
17
- statusLid: {
18
- type: mongoose.Schema.Types.ObjectId,
19
- ref: "Lookup"
20
- },
21
- isActive: { type: String, default: true },
22
- }, { timestamps: true });
23
- const AlertModel = mongoose.model("Alert", alertSchema);
24
- export default AlertModel;
@@ -1,17 +0,0 @@
1
- import mongoose from "mongoose";
2
- const ApprivoSyncJourneySchema = new mongoose.Schema({
3
- applicationId: { type: String, required: true },
4
- milestoneLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
5
- mileStoneStatus: {
6
- type: String,
7
- enum: ['Completed', 'Errored', 'Not Applicable'],
8
- required: true
9
- },
10
- error: { type: String, default: null },
11
- isFirstPull: { type: String, required: true },
12
- jobRunId: { type: mongoose.Schema.Types.ObjectId, ref: "Job_Run" },
13
- startTime: { type: Date, default: null },
14
- endTime: { type: Date, default: null },
15
- }, { timestamps: true });
16
- const ApprivoSyncJourneyModel = mongoose.model('ApprivoSyncJourney', ApprivoSyncJourneySchema);
17
- export default ApprivoSyncJourneyModel;
@@ -1,30 +0,0 @@
1
- import mongoose from "mongoose";
2
- const checklistSchema = new mongoose.Schema({
3
- checkTypeLid: {
4
- type: mongoose.Schema.Types.ObjectId,
5
- ref: "Lookup",
6
- required: true
7
- },
8
- source: {
9
- type: String,
10
- required: true
11
- },
12
- sourceId: {
13
- type: mongoose.Schema.Types.ObjectId,
14
- required: false
15
- },
16
- applicationId: {
17
- type: mongoose.Schema.Types.ObjectId,
18
- ref: "Application",
19
- required: true
20
- },
21
- checkDescription: { type: String },
22
- checkStatusLid: {
23
- type: mongoose.Schema.Types.ObjectId,
24
- ref: "Lookup",
25
- required: true
26
- }
27
- }, { timestamps: true });
28
- checklistSchema.index({ checkDescription: 'text', source: 'text' });
29
- const CheckListModel = mongoose.model("CheckList", checklistSchema);
30
- export default CheckListModel;
@@ -1,10 +0,0 @@
1
- import mongoose from "mongoose";
2
- const DocumentTypeSchema = new mongoose.Schema({
3
- name: { type: String, required: true },
4
- label: { type: String },
5
- source: { type: String, default: null },
6
- parentDocumentTypeId: { type: mongoose.Schema.Types.ObjectId, ref: 'DocumentType', default: null },
7
- matchRules: { type: mongoose.Schema.Types.Mixed }
8
- });
9
- const DocumentTypeModel = mongoose.model('DocumentType', DocumentTypeSchema);
10
- export default DocumentTypeModel;
@@ -1,12 +0,0 @@
1
- export { default as LookupGroupModel } from './lookup-group.model';
2
- export { default as LookupModel } from './lookup.model';
3
- export { default as SystemParameterModel } from './system-parameter.model';
4
- export { default as AlertModel } from './alert.model';
5
- export { default as CheckListModel } from './checklist.model';
6
- export { default as JobSettingModel } from './job-setting.model';
7
- export { default as TaskModel } from './task.model';
8
- export { default as ApprivoSyncJourneyModel } from './apprivo-sync-journey.model';
9
- export { default as JobRunModel } from './job-run.model';
10
- export { default as TaskDocumentTypeModel } from './task-document.model';
11
- export { default as DocumentTypeModel } from './document-type-model';
12
- export { default as SchemaDocModel } from './schema-doc.model';