@dynamatix/gb-schemas 2.0.24 → 2.0.26

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 (212) hide show
  1. package/dist/applicants/applicant-additional-income.model.d.ts +47 -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 +32 -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 +32 -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 +32 -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-commitment-residence.model.d.ts +26 -0
  14. package/dist/applicants/applicant-commitment-residence.model.d.ts.map +1 -1
  15. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts +26 -0
  16. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts.map +1 -1
  17. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts +26 -0
  18. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts.map +1 -1
  19. package/dist/applicants/applicant-credit-data.model.d.ts +27 -0
  20. package/dist/applicants/applicant-credit-data.model.d.ts.map +1 -1
  21. package/dist/applicants/applicant-credit-profile.model.d.ts +27 -0
  22. package/dist/applicants/applicant-credit-profile.model.d.ts.map +1 -1
  23. package/dist/applicants/applicant-direct-debit.model.d.ts +27 -0
  24. package/dist/applicants/applicant-direct-debit.model.d.ts.map +1 -1
  25. package/dist/applicants/applicant-employment-income.model.d.ts +26 -0
  26. package/dist/applicants/applicant-employment-income.model.d.ts.map +1 -1
  27. package/dist/applicants/applicant-employment.model.d.ts +26 -0
  28. package/dist/applicants/applicant-employment.model.d.ts.map +1 -1
  29. package/dist/applicants/applicant-expenditure.model.d.ts +26 -0
  30. package/dist/applicants/applicant-expenditure.model.d.ts.map +1 -1
  31. package/dist/applicants/applicant-income-source.model.d.ts +27 -0
  32. package/dist/applicants/applicant-income-source.model.d.ts.map +1 -1
  33. package/dist/applicants/applicant-income.model.d.ts +26 -12
  34. package/dist/applicants/applicant-income.model.d.ts.map +1 -1
  35. package/dist/applicants/applicant-pension-income.model.d.ts +314 -0
  36. package/dist/applicants/applicant-pension-income.model.d.ts.map +1 -1
  37. package/dist/applicants/applicant-pension-income.model.js +13 -0
  38. package/dist/applicants/applicant-property-income.model.d.ts +26 -0
  39. package/dist/applicants/applicant-property-income.model.d.ts.map +1 -1
  40. package/dist/applicants/applicant-risk-narrative.model.d.ts +27 -0
  41. package/dist/applicants/applicant-risk-narrative.model.d.ts.map +1 -1
  42. package/dist/applicants/applicant-uk-tax-credits.model.d.ts +314 -0
  43. package/dist/applicants/applicant-uk-tax-credits.model.d.ts.map +1 -1
  44. package/dist/applicants/applicant-uk-tax-credits.model.js +2 -0
  45. package/dist/applicants/applicant.model.d.ts +27 -0
  46. package/dist/applicants/applicant.model.d.ts.map +1 -1
  47. package/dist/applications/application-audit.model.d.ts +27 -0
  48. package/dist/applications/application-audit.model.d.ts.map +1 -1
  49. package/dist/applications/application-checklist-Item.model.d.ts +27 -0
  50. package/dist/applications/application-checklist-Item.model.d.ts.map +1 -1
  51. package/dist/applications/application-company-model.d.ts +26 -0
  52. package/dist/applications/application-company-model.d.ts.map +1 -1
  53. package/dist/applications/application-credit-profile.model.d.ts +27 -0
  54. package/dist/applications/application-credit-profile.model.d.ts.map +1 -1
  55. package/dist/applications/application-direct-debit.model.d.ts +26 -0
  56. package/dist/applications/application-direct-debit.model.d.ts.map +1 -1
  57. package/dist/applications/application-document.model.d.ts +27 -0
  58. package/dist/applications/application-document.model.d.ts.map +1 -1
  59. package/dist/applications/application-fieldconfig.model.d.ts +27 -0
  60. package/dist/applications/application-fieldconfig.model.d.ts.map +1 -1
  61. package/dist/applications/application-illustration-model.d.ts +27 -0
  62. package/dist/applications/application-illustration-model.d.ts.map +1 -1
  63. package/dist/applications/application-legal.model.d.ts +27 -0
  64. package/dist/applications/application-legal.model.d.ts.map +1 -1
  65. package/dist/applications/application-mortgage.model.d.ts +26 -0
  66. package/dist/applications/application-mortgage.model.d.ts.map +1 -1
  67. package/dist/applications/application-note.model.d.ts +27 -0
  68. package/dist/applications/application-note.model.d.ts.map +1 -1
  69. package/dist/applications/application-offer.model.d.ts +27 -0
  70. package/dist/applications/application-offer.model.d.ts.map +1 -1
  71. package/dist/applications/application-onboarding.model.d.ts +27 -0
  72. package/dist/applications/application-onboarding.model.d.ts.map +1 -1
  73. package/dist/applications/application-product.model.d.ts +27 -0
  74. package/dist/applications/application-product.model.d.ts.map +1 -1
  75. package/dist/applications/application-productfeatures.model.d.ts +27 -0
  76. package/dist/applications/application-productfeatures.model.d.ts.map +1 -1
  77. package/dist/applications/application-rationale.model.d.ts +27 -0
  78. package/dist/applications/application-rationale.model.d.ts.map +1 -1
  79. package/dist/applications/application-risk-narrative.model.d.ts +27 -0
  80. package/dist/applications/application-risk-narrative.model.d.ts.map +1 -1
  81. package/dist/applications/application-valuation.model.d.ts +27 -0
  82. package/dist/applications/application-valuation.model.d.ts.map +1 -1
  83. package/dist/applications/application.model.d.ts +27 -0
  84. package/dist/applications/application.model.d.ts.map +1 -1
  85. package/dist/applications/broker.model.d.ts +27 -0
  86. package/dist/applications/broker.model.d.ts.map +1 -1
  87. package/dist/applications/document.model.d.ts +27 -0
  88. package/dist/applications/document.model.d.ts.map +1 -1
  89. package/dist/applications/solicitor.model.d.ts +26 -0
  90. package/dist/applications/solicitor.model.d.ts.map +1 -1
  91. package/dist/index.d.ts +0 -1
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/product-catalogues/product-catalogue.model.d.ts +27 -0
  94. package/dist/product-catalogues/product-catalogue.model.d.ts.map +1 -1
  95. package/dist/product-catalogues/product-definitions.model.d.ts +27 -0
  96. package/dist/product-catalogues/product-definitions.model.d.ts.map +1 -1
  97. package/dist/product-catalogues/product-variant.model.d.ts +27 -0
  98. package/dist/product-catalogues/product-variant.model.d.ts.map +1 -1
  99. package/dist/properties/property.model.d.ts +26 -0
  100. package/dist/properties/property.model.d.ts.map +1 -1
  101. package/dist/properties/security.model.d.ts +27 -0
  102. package/dist/properties/security.model.d.ts.map +1 -1
  103. package/dist/shared/alert.model.d.ts +27 -0
  104. package/dist/shared/alert.model.d.ts.map +1 -1
  105. package/dist/shared/apprivo-sync-journey.model.d.ts +27 -0
  106. package/dist/shared/apprivo-sync-journey.model.d.ts.map +1 -1
  107. package/dist/shared/checklist.model.d.ts +27 -0
  108. package/dist/shared/checklist.model.d.ts.map +1 -1
  109. package/dist/shared/document-type-model.d.ts +27 -0
  110. package/dist/shared/document-type-model.d.ts.map +1 -1
  111. package/dist/shared/job-run.model.d.ts +27 -0
  112. package/dist/shared/job-run.model.d.ts.map +1 -1
  113. package/dist/shared/job-setting.model.d.ts +27 -0
  114. package/dist/shared/job-setting.model.d.ts.map +1 -1
  115. package/dist/shared/lookup-group.model.d.ts +27 -0
  116. package/dist/shared/lookup-group.model.d.ts.map +1 -1
  117. package/dist/shared/lookup.model.d.ts +27 -0
  118. package/dist/shared/lookup.model.d.ts.map +1 -1
  119. package/dist/shared/schema-doc.model.d.ts +27 -0
  120. package/dist/shared/schema-doc.model.d.ts.map +1 -1
  121. package/dist/shared/system-parameter.model.d.ts +27 -0
  122. package/dist/shared/system-parameter.model.d.ts.map +1 -1
  123. package/dist/shared/task-document.model.d.ts +27 -0
  124. package/dist/shared/task-document.model.d.ts.map +1 -1
  125. package/dist/shared/task.model.d.ts +27 -0
  126. package/dist/shared/task.model.d.ts.map +1 -1
  127. package/dist/underwriter/underwriter.model.d.ts +27 -0
  128. package/dist/underwriter/underwriter.model.d.ts.map +1 -1
  129. package/dist/users/auth-log.model.d.ts +27 -0
  130. package/dist/users/auth-log.model.d.ts.map +1 -1
  131. package/dist/users/permission.model.d.ts +27 -0
  132. package/dist/users/permission.model.d.ts.map +1 -1
  133. package/dist/users/role-group.model.d.ts +27 -0
  134. package/dist/users/role-group.model.d.ts.map +1 -1
  135. package/dist/users/role.model.d.ts +27 -0
  136. package/dist/users/role.model.d.ts.map +1 -1
  137. package/dist/users/tasks.model.d.ts +27 -0
  138. package/dist/users/tasks.model.d.ts.map +1 -1
  139. package/dist/users/user.model.d.ts +27 -0
  140. package/dist/users/user.model.d.ts.map +1 -1
  141. package/dist/value-objects/pound.d.ts +26 -0
  142. package/dist/value-objects/pound.d.ts.map +1 -1
  143. package/dist/value-objects/sort-code.d.ts +26 -0
  144. package/dist/value-objects/sort-code.d.ts.map +1 -1
  145. package/entities/applications/application-direct-debit.entity.ts +1 -1
  146. package/package.json +1 -1
  147. package/prisma/applicants/applicant.prisma +123 -124
  148. package/prisma/applications/application-direct-debit.prisma +3 -3
  149. package/prisma/applications/application.prisma +2 -0
  150. package/prisma/migrations/20250508092417_update_application_schema/migration.sql +3 -0
  151. package/prisma/migrations/20250508094735_update_direct_debit_schema/migration.sql +2 -0
  152. package/prisma/schema.prisma +126 -125
  153. package/dist/applicants/applicant-credit-data.model.js +0 -11
  154. package/dist/applicants/applicant-credit-profile.model.js +0 -20
  155. package/dist/applicants/applicant-direct-debit.model.js +0 -17
  156. package/dist/applicants/applicant-employment.model.js +0 -50
  157. package/dist/applicants/applicant-expenditure.model.js +0 -54
  158. package/dist/applicants/applicant-income-source.model.js +0 -9
  159. package/dist/applicants/applicant-income.model.js +0 -81
  160. package/dist/applicants/applicant-risk-narrative.model.js +0 -13
  161. package/dist/applicants/applicant.model.js +0 -223
  162. package/dist/applicants/index.js +0 -13
  163. package/dist/applications/application-audit.model.js +0 -42
  164. package/dist/applications/application-checklist-Item.model.js +0 -45
  165. package/dist/applications/application-company-model.js +0 -120
  166. package/dist/applications/application-credit-profile.model.js +0 -12
  167. package/dist/applications/application-direct-debit.model.js +0 -92
  168. package/dist/applications/application-document.model.js +0 -35
  169. package/dist/applications/application-fieldconfig.model.js +0 -7
  170. package/dist/applications/application-illustration-model.js +0 -6
  171. package/dist/applications/application-legal.model.js +0 -7
  172. package/dist/applications/application-mortgage.model.js +0 -271
  173. package/dist/applications/application-note.model.js +0 -78
  174. package/dist/applications/application-offer.model.js +0 -6
  175. package/dist/applications/application-onboarding.model.js +0 -9
  176. package/dist/applications/application-product.model.js +0 -67
  177. package/dist/applications/application-rationale.model.js +0 -38
  178. package/dist/applications/application-risk-narrative.model.js +0 -12
  179. package/dist/applications/application-valuation.model.js +0 -15
  180. package/dist/applications/application.model.js +0 -153
  181. package/dist/applications/broker.model.js +0 -21
  182. package/dist/applications/document.model.js +0 -35
  183. package/dist/applications/index.js +0 -20
  184. package/dist/applications/solicitor.model.js +0 -114
  185. package/dist/index.js +0 -9
  186. package/dist/product-catalogues/index.js +0 -3
  187. package/dist/product-catalogues/product-catalogue.model.js +0 -18
  188. package/dist/product-catalogues/product-definitions.model.js +0 -26
  189. package/dist/product-catalogues/product-variant.model.js +0 -12
  190. package/dist/properties/index.js +0 -2
  191. package/dist/properties/property.model.js +0 -144
  192. package/dist/shared/alert.model.js +0 -24
  193. package/dist/shared/apprivo-sync-journey.model.js +0 -17
  194. package/dist/shared/checklist.model.js +0 -30
  195. package/dist/shared/document-type-model.js +0 -10
  196. package/dist/shared/index.js +0 -12
  197. package/dist/shared/job-run.model.js +0 -14
  198. package/dist/shared/job-setting.model.js +0 -11
  199. package/dist/shared/lookup-group.model.js +0 -16
  200. package/dist/shared/lookup.model.js +0 -20
  201. package/dist/shared/system-parameter.model.js +0 -32
  202. package/dist/shared/task-document.model.js +0 -23
  203. package/dist/shared/task.model.js +0 -15
  204. package/dist/underwriter/index.js +0 -1
  205. package/dist/underwriter/underwriter.model.js +0 -17
  206. package/dist/users/auth-log.model.js +0 -21
  207. package/dist/users/index.js +0 -6
  208. package/dist/users/permission.model.js +0 -10
  209. package/dist/users/role-group.model.js +0 -14
  210. package/dist/users/role.model.js +0 -13
  211. package/dist/users/tasks.model.js +0 -15
  212. package/dist/users/user.model.js +0 -30
@@ -1,67 +0,0 @@
1
- import mongoose from "mongoose";
2
- import { Pound } from "../value-objects/pound";
3
- const productSchema = new mongoose.Schema({
4
- applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
5
- description: "Unique identifier for the application"
6
- },
7
- selectedProduct: { type: String, default: "" },
8
- lendingTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
9
- pageValidFlag: { type: Boolean, get: (value) => (value ? "Yes" : "No") },
10
- repaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
11
- numberOfYearsToRepay: { type: Number, default: 0 },
12
- repaymentVehicle: { type: String, required: true, default: '', maxLength: 100 },
13
- fixedAmount: { type: Pound, default: 0.00, required: false },
14
- isFinanceRecommendedToApplicantLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
15
- procFeeRateLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
16
- networkClubSubmission: { type: Boolean, required: true, get: (value) => (value ? "Yes" : "No") },
17
- clubNetworkNameLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
18
- introducerSubmission: { type: Boolean, required: true, get: (value) => (value ? "Yes" : "No") },
19
- introducer: { type: String, default: '' },
20
- bdm: { type: String, required: true, default: '' },
21
- tempAppFee: { type: Pound, default: 0.00, required: true },
22
- productFeePaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" }
23
- });
24
- // virtual property 'lendingType'
25
- productSchema.virtual('lendingType').get(function () {
26
- const lendingType = this.lendingTypeLid;
27
- return lendingType && lendingType instanceof mongoose.Types.ObjectId
28
- ? null
29
- : lendingType?.name || null;
30
- });
31
- // virtual property 'repaymentType'
32
- productSchema.virtual('repaymentType').get(function () {
33
- const repaymentType = this.repaymentTypeLid;
34
- return repaymentType && repaymentType instanceof mongoose.Types.ObjectId
35
- ? null
36
- : repaymentType?.name || null;
37
- });
38
- // virtual property 'isFinanceRecommendedToApplicant'
39
- productSchema.virtual('isFinanceRecommendedToApplicant').get(function () {
40
- const isFinanceRecommendedToApplicant = this.isFinanceRecommendedToApplicantLid;
41
- return isFinanceRecommendedToApplicant && isFinanceRecommendedToApplicant instanceof mongoose.Types.ObjectId
42
- ? null
43
- : isFinanceRecommendedToApplicant?.name || null;
44
- });
45
- // virtual property 'procFeeRate'
46
- productSchema.virtual('procFeeRate').get(function () {
47
- const procFeeRate = this.procFeeRateLid;
48
- return procFeeRate && procFeeRate instanceof mongoose.Types.ObjectId
49
- ? null
50
- : procFeeRate?.name || null;
51
- });
52
- // virtual property 'clubNetworkName'
53
- productSchema.virtual('clubNetworkName').get(function () {
54
- const clubNetworkName = this.clubNetworkNameLid;
55
- return clubNetworkName && clubNetworkName instanceof mongoose.Types.ObjectId
56
- ? null
57
- : clubNetworkName?.name || null;
58
- });
59
- // virtual property 'productFeePaymentType'
60
- productSchema.virtual('productFeePaymentType').get(function () {
61
- const productFeePaymentType = this.productFeePaymentTypeLid;
62
- return productFeePaymentType && productFeePaymentType instanceof mongoose.Types.ObjectId
63
- ? null
64
- : productFeePaymentType?.name || null;
65
- });
66
- const ProductModel = mongoose.model("Product", productSchema);
67
- export default ProductModel;
@@ -1,38 +0,0 @@
1
- import mongoose from "mongoose";
2
- const rationaleSchema = new mongoose.Schema({
3
- applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true },
4
- affordabilityDescription: { type: String, default: "" },
5
- affordabilityAreaOfOfferCondition: { type: String, default: "" },
6
- affordabilityAreaOfConcern: { type: String, default: "" },
7
- affordabilityStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
8
- applicantsDescription: { type: String, default: "" },
9
- applicantsAreaOfOfferCondition: { type: String, default: "" },
10
- applicantsAreaOfConcern: { type: String, default: "" },
11
- applicantsStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
12
- creditConductDescription: { type: String, default: "" },
13
- creditConductAreaOfOfferCondition: { type: String, default: "" },
14
- creditConductAreaOfConcern: { type: String, default: "" },
15
- creditConductStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
16
- fraudCheckDescription: { type: String, default: "" },
17
- fraudCheckAreaOfOfferCondition: { type: String, default: "" },
18
- fraudCheckAreaOfConcern: { type: String, default: "" },
19
- fraudCheckStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
20
- incomeSourceDescription: { type: String, default: "" },
21
- incomeSourceAreaOfOfferCondition: { type: String, default: "" },
22
- incomeSourceAreaOfConcern: { type: String, default: "" },
23
- incomeSourceStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
24
- loanDescription: { type: String, default: "" },
25
- loanAreaOfOfferCondition: { type: String, default: "" },
26
- loanAreaOfConcern: { type: String, default: "" },
27
- loanStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
28
- securityDescription: { type: String, default: "" },
29
- securityAreaOfOfferCondition: { type: String, default: "" },
30
- securityAreaOfConcern: { type: String, default: "" },
31
- securityStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
32
- propertyDescription: { type: String, default: "" },
33
- propertyAreaOfOfferCondition: { type: String, default: "" },
34
- propertyAreaOfConcern: { type: String, default: "" },
35
- propertyStatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
36
- });
37
- const ApplicationRationaleModel = mongoose.model("ApplicationRationale", rationaleSchema);
38
- export default ApplicationRationaleModel;
@@ -1,12 +0,0 @@
1
- import mongoose from 'mongoose';
2
- const applicantionRiskNarrativeSchema = new mongoose.Schema({
3
- call1RequestedOn: { type: String },
4
- call2RequestedOn: { type: String },
5
- call2StatusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
6
- rationaleForRiskRating: { type: String },
7
- retryCount: { type: String },
8
- riskRating: { type: String },
9
- statusLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
10
- });
11
- const ApplicationRiskNarrativeModel = mongoose.model('ApplicationRiskNarrative', applicantionRiskNarrativeSchema);
12
- export default ApplicationRiskNarrativeModel;
@@ -1,15 +0,0 @@
1
- import mongoose from "mongoose";
2
- const valuationSchema = new mongoose.Schema({
3
- amount: { type: String },
4
- epcRating: { type: String, default: "" },
5
- epcScore: { type: String },
6
- estimatedRentalValue: { type: String },
7
- instructionId: { type: String, default: "" },
8
- instructionStatus: { type: String, default: "" },
9
- instructionStatusComment: { type: String, default: "" },
10
- isManual: { type: String, default: false },
11
- squareMetres: { type: String },
12
- valuerNotes: { type: String, default: "" },
13
- version: { type: String, default: "" }
14
- });
15
- export default valuationSchema;
@@ -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';