@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,120 +0,0 @@
1
- import mongoose from "mongoose";
2
- import { Pound } from "./../value-objects/pound";
3
- const ApplicantShareholdingSchema = new mongoose.Schema({
4
- applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true, default: null },
5
- applicantName: { type: String, default: "" },
6
- directorShareholderLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
7
- shareholding: { type: Number, min: 0, max: 100, default: null }
8
- }, { _id: false });
9
- const companySchema = new mongoose.Schema({
10
- applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
11
- description: "Unique identifier for the application"
12
- },
13
- pageValidFlag: { type: Boolean, default: true, },
14
- registeredName: { type: String, required: true, maxlength: 70, default: '' }, // form
15
- businessTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }, // form
16
- registeredNumber: { type: Number, max: 99999999, default: 0 }, // form
17
- taxJurisdictionLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }, // form
18
- tradingSince: { type: String, default: null }, // form
19
- natureOfBusiness: { type: String, maxlength: 100, default: '' }, // form
20
- yearEnd: { type: String, default: null }, // form
21
- addressPostCode: { type: String, maxlength: 50, default: '' }, // form
22
- addressLine1: { type: String, required: true, maxlength: 35, default: '' }, // form
23
- addressLine2: { type: String, default: '', maxlength: 35 }, // form
24
- addressLine3: { type: String, default: '', maxlength: 35 }, // form
25
- addressCity: { type: String, default: '', maxlength: 30 }, // form
26
- addressCountryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }, // form
27
- applicationTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }, // form
28
- applicantShareholding: [ApplicantShareholdingSchema], // form
29
- yearEnd1: { type: Number, required: true, max: 9999 }, // form
30
- turnoverYear1: { type: Pound, required: true, default: 0.00 }, // form
31
- netProfitYear1: { type: Pound, required: true, default: 0.00 }, // form
32
- yearEnd2: { type: Number, required: true, max: 9999 }, // form
33
- turnoverYear2: { type: Pound, required: true, default: 0.00 }, // form
34
- netProfitYear2: { type: Pound, required: true, default: 0.00 }, // form
35
- yearEnd3: { type: Number, required: true, max: 9999 }, // form
36
- turnoverYear3: { type: Pound, required: true, default: 0.00 }, // form
37
- netProfitYear3: { type: Pound, required: true, default: 0.00 }, // form
38
- // Purchase form - Company section
39
- companyCreditDefaults: { type: String, required: true, default: '' }, // form
40
- companyCountyCourtJudgment: { type: String, required: true, default: '' }, // form
41
- companySecuredArrears: { type: String, required: true, default: '' }, // form
42
- companyUnsecuredArrears: { type: String, required: true, default: '' }, // form
43
- companyBankruptcy: { type: String, required: true, default: '' }, // form
44
- companyBankruptcyYes: { type: Boolean, default: false, },
45
- companyBankruptcyNo: { type: Boolean, default: true, },
46
- companyCCJInLastThreeYearYes: { type: Boolean, default: false, },
47
- companyCCJInLastThreeYearNo: { type: Boolean, default: true, },
48
- companyDefaultsInLastYearYes: { type: Boolean, default: false, },
49
- companyDefaultsInLastYearNo: { type: Boolean, default: true, },
50
- companyAnyVoluntaryEnforcedPossessionYes: { type: Boolean, default: false, },
51
- companyAnyVoluntaryEnforcedPossessionNo: { type: Boolean, default: true, },
52
- // Not in form Fields
53
- doYouKnowRegisteredNumber: { type: Boolean, default: true, },
54
- sicCodes: [{ type: String, default: "" }],
55
- epc: { type: String, default: "" },
56
- remainingLease: { type: String, default: "" },
57
- dateOfIncorporation: { type: String, default: null },
58
- }, {
59
- timestamps: true,
60
- toJSON: { virtuals: true, getters: true },
61
- toObject: { virtuals: true, getters: true }
62
- });
63
- ///////////////// HOOKS //////////////////
64
- const yesNoPairs = [
65
- ["companyBankruptcyYes", "companyBankruptcyNo"],
66
- ["companyCCJInLastThreeYearYes", "companyCCJInLastThreeYearNo"],
67
- ["companyDefaultsInLastYearYes", "companyDefaultsInLastYearNo"],
68
- ["companyAnyVoluntaryEnforcedPossessionYes", "companyAnyVoluntaryEnforcedPossessionNo"],
69
- ];
70
- function handleYesNoLogic(update) {
71
- const $set = update?.$set ?? update; // Handles both direct update and $set syntax
72
- yesNoPairs.forEach(([yesKey, noKey]) => {
73
- if (yesKey in $set) {
74
- $set[noKey] = !$set[yesKey]; // Set No field to opposite of Yes field
75
- }
76
- // Prevent direct updates to No fields
77
- if (noKey in $set) {
78
- delete $set[noKey];
79
- }
80
- });
81
- }
82
- // Apply to various update operations - handle both cases
83
- companySchema.pre("updateOne", function (next) {
84
- handleYesNoLogic(this.getUpdate());
85
- next();
86
- });
87
- const virtualBusinessType = companySchema.virtual('businessType', {
88
- ref: 'Lookup',
89
- localField: 'businessTypeLid',
90
- foreignField: '_id',
91
- justOne: true,
92
- options: { select: 'label' }
93
- });
94
- virtualBusinessType.description = 'Populated lookup value for business type';
95
- const virtualTaxJurisdiction = companySchema.virtual('taxJurisdiction', {
96
- ref: 'Lookup',
97
- localField: 'taxJurisdictionLid',
98
- foreignField: '_id',
99
- justOne: true,
100
- options: { select: 'label' }
101
- });
102
- virtualTaxJurisdiction.description = 'Populated lookup value for tax jurisdiction';
103
- const virtualAddressCountry = companySchema.virtual('addressCountry', {
104
- ref: 'Lookup',
105
- localField: 'addressCountryLid',
106
- foreignField: '_id',
107
- justOne: true,
108
- options: { select: 'label' }
109
- });
110
- virtualAddressCountry.description = 'Populated lookup value for address country';
111
- const virtualApplicationType = companySchema.virtual('applicationType', {
112
- ref: 'Lookup',
113
- localField: 'applicationTypeLid',
114
- foreignField: '_id',
115
- justOne: true,
116
- options: { select: 'label' }
117
- });
118
- virtualApplicationType.description = 'Populated lookup value for application type';
119
- const ApplicationCompanyModel = mongoose.model("ApplicationCompany", companySchema);
120
- export default ApplicationCompanyModel;
@@ -1,12 +0,0 @@
1
- import mongoose from "mongoose";
2
- const creditProfileSchema = new mongoose.Schema({
3
- companyAnyVoluntaryEnforcedPossessionNo: { type: String, default: false },
4
- companyAnyVoluntaryEnforcedPossessionYes: { type: String, default: "" },
5
- companyBankruptcyNo: { type: String, default: false },
6
- companyBankruptcyYes: { type: String, default: "" },
7
- companyCCJInLastThreeYearNo: { type: String, default: false },
8
- companyCCJInLastThreeYearYes: { type: String, default: "" },
9
- companyDefaultsInLastYearNo: { type: String, default: false },
10
- companyDefaultsInLastYearYes: { type: String, default: "" }
11
- });
12
- export default creditProfileSchema;
@@ -1,92 +0,0 @@
1
- import mongoose from 'mongoose';
2
- import { SortCode } from '../value-objects/sort-code';
3
- const applicationDirectDebitSchema = new mongoose.Schema({
4
- applicationId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: 'Application',
7
- description: 'Reference to the application this direct debit belongs to',
8
- },
9
- accountNumber: {
10
- type: Number,
11
- isRequired: true,
12
- maxLength: 8,
13
- description: 'Bank account number of the applicant',
14
- },
15
- addressLine1: {
16
- type: String,
17
- description: 'First line of the applicant’s address'
18
- },
19
- addressLine2: {
20
- type: String,
21
- description: 'Second line of the applicant’s address'
22
- },
23
- applicantId: {
24
- type: mongoose.Schema.Types.ObjectId,
25
- ref: 'Applicant',
26
- description: 'List of applicant IDs associated with this direct debit',
27
- },
28
- branch: {
29
- type: String,
30
- description: 'Branch name or code of the bank',
31
- required: true
32
- },
33
- city: {
34
- type: String,
35
- description: 'City of the applicant’s address',
36
- },
37
- contactPostcode: {
38
- type: String,
39
- description: 'Postcode for correspondence',
40
- requird: true
41
- },
42
- institution: {
43
- type: String,
44
- description: 'Name of the financial institution',
45
- required: true,
46
- },
47
- isConfirmDeclaration: {
48
- type: Boolean,
49
- description: 'Whether the applicant has confirmed the declaration'
50
- },
51
- nameOfAccountHolder: {
52
- type: String,
53
- description: 'Full name of the bank account holder',
54
- required: true,
55
- },
56
- selectedPaymentDayLid: {
57
- type: mongoose.Schema.Types.ObjectId,
58
- ref: 'Lookup',
59
- description: 'Lookup reference for selected payment day',
60
- },
61
- sortCode: {
62
- type: SortCode,
63
- description: 'UK bank sort code in XX-XX-XX format',
64
- required: true,
65
- },
66
- }, {
67
- timestamps: true,
68
- toJSON: { virtuals: true, getters: true },
69
- toObject: { virtuals: true, getters: true }
70
- });
71
- const virtualselectedPaymentDay = applicationDirectDebitSchema.virtual('selectedPaymentDay', {
72
- ref: 'Lookup',
73
- localField: 'selectedPaymentDayLid',
74
- foreignField: '_id',
75
- justOne: true,
76
- options: {
77
- select: 'label' // Only fetch the 'label' field from the Lookup collection
78
- }
79
- });
80
- virtualselectedPaymentDay.description = 'Populated lookup value for the selected payment day';
81
- const virtualApplicants = applicationDirectDebitSchema.virtual('applicants', {
82
- ref: 'Applicant',
83
- localField: 'applicantId',
84
- foreignField: '_id',
85
- justOne: true,
86
- options: {
87
- select: 'fullName'
88
- }
89
- });
90
- virtualApplicants.description = 'Full Name of the applicant';
91
- const ApplicationDirectDebitModel = mongoose.model("Application_DirectDebit", applicationDirectDebitSchema);
92
- export default ApplicationDirectDebitModel;
@@ -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: String, 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 ApplicationDocumentModel = mongoose.model("ApplicationDocument", documentSchema);
35
- export default ApplicationDocumentModel;
@@ -1,7 +0,0 @@
1
- import mongoose from "mongoose";
2
- const fieldConfigSchema = new mongoose.Schema({
3
- fieldName: { type: String, required: true, unique: true },
4
- validateProductOnChange: { type: String, default: true }
5
- });
6
- const ApplicationFieldConfigModel = mongoose.model('FieldConfig', fieldConfigSchema);
7
- export default ApplicationFieldConfigModel;
@@ -1,6 +0,0 @@
1
- import mongoose from "mongoose";
2
- const illustrationSchema = new mongoose.Schema({
3
- date: { type: Date } // e.g., the date of illustration
4
- });
5
- const IllustrationModel = mongoose.model("Illustration", illustrationSchema);
6
- export default IllustrationModel;
@@ -1,7 +0,0 @@
1
- import mongoose from "mongoose";
2
- const legalSchema = new mongoose.Schema({
3
- assignedSolicitor: { type: String, default: "" },
4
- solicitorsReference: { type: String, default: "" }
5
- });
6
- const LegalModel = mongoose.model("Legal", legalSchema);
7
- export default LegalModel;
@@ -1,271 +0,0 @@
1
- import mongoose from "mongoose";
2
- import { Pound } from "../value-objects/pound";
3
- const mortgageSchema = new mongoose.Schema({
4
- applicationId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: "Application",
7
- required: true,
8
- description: "Unique identifier for the application",
9
- },
10
- pageValidFlag: {
11
- type: Boolean,
12
- default: false,
13
- description: "True if all mandatory fields have been completed, otherwise false",
14
- },
15
- existingMortgageLender: {
16
- type: String,
17
- maxlength: 35,
18
- description: "Name of the existing mortgage lender",
19
- },
20
- topSlicing: {
21
- type: Boolean,
22
- default: false,
23
- description: "Indicates if the mortgage is being paid off using top slicing",
24
- },
25
- purposeOfMortgage: {
26
- type: String,
27
- required: true,
28
- maxlength: 50,
29
- description: "Purpose of the mortgage (e.g., purchase, refinance)",
30
- },
31
- depositComeFromLids: {
32
- type: [mongoose.Schema.Types.ObjectId],
33
- ref: "Lookup",
34
- required: true,
35
- default: null,
36
- description: "Where the deposit for the mortgage will come from",
37
- },
38
- ifOtherDetails: {
39
- type: String,
40
- maxlength: 50,
41
- required: true,
42
- description: "Details if the deposit comes from 'Other'",
43
- },
44
- purchasePrice: {
45
- type: Pound,
46
- required: true,
47
- description: "Purchase price of the property",
48
- },
49
- repaymentTypeLid: {
50
- type: mongoose.Schema.Types.ObjectId,
51
- ref: "Lookup",
52
- required: true,
53
- default: null,
54
- description: "Lookup ID representing the type of repayment (e.g., interest-only, repayment)",
55
- },
56
- exitStrategyLid: {
57
- type: mongoose.Schema.Types.ObjectId,
58
- ref: "Lookup",
59
- required: true,
60
- default: null,
61
- description: "Lookup ID representing the Exit strategy for the mortgage)",
62
- },
63
- isCapitalRaise: {
64
- type: Boolean,
65
- default: false,
66
- description: "Indicates if capital raising is part of this finance",
67
- },
68
- purchaseDate: {
69
- type: String,
70
- required: true,
71
- default: null,
72
- description: "Purchase date of the property",
73
- },
74
- estimatedValue: {
75
- type: Pound,
76
- required: true,
77
- description: "Estimated value of the property",
78
- },
79
- loanRequired: {
80
- type: Pound,
81
- required: true,
82
- description: "Amount of finance required",
83
- },
84
- monthlyRentalIncome: {
85
- type: Pound,
86
- required: true,
87
- description: "Monthly rental income from the property",
88
- },
89
- outstandingBalance: {
90
- type: Pound,
91
- required: true,
92
- description: "Outstanding balance on the existing mortgage",
93
- },
94
- fundRaisedFor: {
95
- type: String,
96
- maxlength: 250,
97
- required: true,
98
- description: "What the funds raised will be used for",
99
- },
100
- sourceOfFundsLid: {
101
- type: mongoose.Schema.Types.ObjectId,
102
- ref: "Lookup",
103
- required: true,
104
- default: null,
105
- description: "Lookup ID representing the Main source of income for monthly finance payments",
106
- },
107
- sourceOfFundDetails: {
108
- type: String,
109
- maxlength: 50,
110
- required: true,
111
- description: "Additional details if the source of funds is 'Other'",
112
- },
113
- propertyValuationDetails: {
114
- type: String,
115
- maxlength: 35,
116
- required: true,
117
- description: "Details on who to contact for property valuation",
118
- },
119
- telephoneNumber: {
120
- type: String,
121
- maxlength: 15,
122
- required: true,
123
- description: "Contact number for property valuation",
124
- },
125
- isDistressedSale: {
126
- type: Boolean,
127
- default: false,
128
- required: true,
129
- description: "Indicates if this is a distressed sale",
130
- },
131
- isPurchasedBelowMarketValue: {
132
- type: Boolean,
133
- default: false,
134
- required: true,
135
- description: "Indicates if the property is purchased below market value",
136
- },
137
- isPurchasedAsSale: {
138
- type: Boolean,
139
- default: false,
140
- required: true,
141
- description: "Indicates if the property is purchased as a sale and rent back",
142
- },
143
- isReadyToSell: {
144
- type: Boolean,
145
- default: false,
146
- description: "Indicates if the property is ready to sell or let out",
147
- },
148
- isGovernmentInitiative: {
149
- type: Boolean,
150
- default: false,
151
- description: "Indicates if this purchase is part of a government initiative",
152
- },
153
- vendorsName: {
154
- type: String,
155
- maxlength: 35,
156
- description: "Vendor's name in case of property sale",
157
- },
158
- saleMadeLid: {
159
- type: mongoose.Schema.Types.ObjectId,
160
- ref: "Lookup",
161
- description: "Method of sale made",
162
- },
163
- isTheIntentionToLet: {
164
- type: Boolean,
165
- default: false,
166
- description: "Indicates if the intention is to let out the property",
167
- },
168
- proposedTenantsLids: {
169
- type: [mongoose.Schema.Types.ObjectId],
170
- ref: "Lookup",
171
- description: "Proposed tenants for the property",
172
- },
173
- leaseTypeLid: {
174
- type: mongoose.Schema.Types.ObjectId,
175
- ref: "Lookup",
176
- required: true,
177
- default: null,
178
- description: "Lease type for the property",
179
- },
180
- }, {
181
- timestamps: true,
182
- toJSON: { virtuals: true },
183
- toObject: { virtuals: true },
184
- });
185
- // const virtualDepositComeFrom = mortgageSchema.virtual("depositComeFrom", {
186
- // ref: "Lookup",
187
- // localField: "depositComeFromLid",
188
- // foreignField: "_id",
189
- // justOne: false,
190
- // }) as VirtualWithDescription;
191
- // virtualDepositComeFrom.description =
192
- // "Populated lookup values for where the deposit for the mortgage will come from";
193
- // const virtualRepaymentType = mortgageSchema.virtual("repaymentType", {
194
- // ref: "Lookup",
195
- // localField: "repaymentTypeLid",
196
- // foreignField: "_id",
197
- // justOne: true,
198
- // }) as VirtualWithDescription;
199
- // virtualRepaymentType.description =
200
- // "Populated lookup value representing the type of repayment";
201
- // const virtualExitStrategy = mortgageSchema.virtual("exitStrategy", {
202
- // ref: "Lookup",
203
- // localField: "exitStrategyLid",
204
- // foreignField: "_id",
205
- // justOne: true,
206
- // }) as VirtualWithDescription;
207
- // virtualExitStrategy.description = "Populated lookup value for exit strategy";
208
- // const virtualSourceOfFunds = mortgageSchema.virtual("sourceOfFunds", {
209
- // ref: "Lookup",
210
- // localField: "sourceOfFundsLid",
211
- // foreignField: "_id",
212
- // justOne: true,
213
- // }) as VirtualWithDescription;
214
- // virtualSourceOfFunds.description =
215
- // "Populated lookup value for the main source of income for monthly finance payments";
216
- // const virtualSaleMade = mortgageSchema.virtual("saleMade", {
217
- // ref: "Lookup",
218
- // localField: "saleMadeLid",
219
- // foreignField: "_id",
220
- // justOne: true,
221
- // }) as VirtualWithDescription;
222
- // virtualSaleMade.description = "Populated lookup value for method of sale made";
223
- // const virtualProposedTenants = mortgageSchema.virtual("proposedTenants", {
224
- // ref: "Lookup",
225
- // localField: "proposedTenantsLid",
226
- // foreignField: "_id",
227
- // justOne: false,
228
- // }) as VirtualWithDescription;
229
- // virtualProposedTenants.description =
230
- // "Populated lookup values for proposed tenants of the property";
231
- // const virtualLeaseType = mortgageSchema.virtual("leaseType", {
232
- // ref: "Lookup",
233
- // localField: "leaseTypeLid",
234
- // foreignField: "_id",
235
- // justOne: true,
236
- // }) as VirtualWithDescription;
237
- // virtualLeaseType.description = "Populated lookup value for lease type";
238
- // virtual property 'applicationType'
239
- mortgageSchema.virtual("applicationType").get(function () {
240
- return this.applicationId?.applicationTypeLid instanceof
241
- mongoose.Types.ObjectId
242
- ? null
243
- : this.applicationId?.applicationTypeLid?.text || null;
244
- });
245
- // virtual property 'lendingType'
246
- mortgageSchema.virtual("lendingType").get(function () {
247
- return this.applicationId?.lendingTypeLid instanceof
248
- mongoose.Types.ObjectId
249
- ? null
250
- : this.applicationId?.lendingTypeLid?.text || null;
251
- });
252
- // virtual property 'purchaseType'
253
- mortgageSchema.virtual("purchaseType").get(function () {
254
- return this.applicationId?.purchaseTypeLid instanceof
255
- mongoose.Types.ObjectId
256
- ? null
257
- : this.applicationId?.purchaseTypeLid?.text || null;
258
- });
259
- // virtual property 'lendingType'
260
- mortgageSchema.virtual("sourceOfWealth").get(function () {
261
- const sourceOfWealthLids = this.applicationId?.sourceOfWealthLids;
262
- if (!Array.isArray(sourceOfWealthLids)) {
263
- return null;
264
- }
265
- return sourceOfWealthLids
266
- .filter((lid) => !(lid instanceof mongoose.Types.ObjectId))
267
- .map((lid) => lid?.text || null)
268
- .filter((text) => text !== null);
269
- });
270
- const MortgageModel = mongoose.model("Mortgage", mortgageSchema);
271
- export default MortgageModel;
@@ -1,78 +0,0 @@
1
- import mongoose from "mongoose";
2
- const noteSchema = new mongoose.Schema({
3
- applicationId: { type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true },
4
- noteId: {
5
- type: String,
6
- default: null
7
- },
8
- createdOn: {
9
- type: String,
10
- default: null
11
- },
12
- createdBy: {
13
- type: String,
14
- default: null
15
- },
16
- username: {
17
- type: String,
18
- default: null
19
- },
20
- createdByUserId: {
21
- type: mongoose.Schema.Types.ObjectId, ref: "User",
22
- },
23
- typeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
24
- subTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
25
- subject: {
26
- type: String,
27
- default: null
28
- },
29
- note: {
30
- type: String,
31
- required: true
32
- },
33
- reminderDate: {
34
- type: String,
35
- default: null
36
- },
37
- attachmentDocumentId: {
38
- type: String,
39
- default: null
40
- },
41
- assignedOperation: {
42
- type: String,
43
- default: ''
44
- },
45
- autoCreated: {
46
- type: String,
47
- default: false
48
- },
49
- additionalData: {
50
- type: mongoose.Schema.Types.Mixed,
51
- default: null
52
- },
53
- autoCreatedId: {
54
- type: String,
55
- default: null
56
- },
57
- assignedTo: {
58
- type: String,
59
- default: ''
60
- },
61
- assignedBy: {
62
- type: String,
63
- default: null
64
- },
65
- assignedByUserId: {
66
- type: mongoose.Schema.Types.ObjectId, ref: "User",
67
- },
68
- comment: {
69
- type: String,
70
- default: null
71
- },
72
- reminderStatus: {
73
- type: String,
74
- default: 'None'
75
- }
76
- });
77
- const ApplictionNoteModel = mongoose.model("ApplictionNote", noteSchema);
78
- export default ApplictionNoteModel;
@@ -1,6 +0,0 @@
1
- import mongoose from "mongoose";
2
- const offerSchema = new mongoose.Schema({
3
- date: { type: String } // The date associated with the offer
4
- });
5
- const OfferModel = mongoose.model("Offer", offerSchema);
6
- export default OfferModel;
@@ -1,9 +0,0 @@
1
- import mongoose from "mongoose";
2
- const onboardingSchema = new mongoose.Schema({
3
- errors: { type: String, default: "" },
4
- status: { type: String, default: "" },
5
- statusDate: { type: String },
6
- warnings: { type: String, default: "" }
7
- });
8
- const ApplicationOnboardingModel = mongoose.model("ApplicationOnboarding", onboardingSchema);
9
- export default ApplicationOnboardingModel;