@dynamatix/gb-schemas 2.0.1 → 2.0.3

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 (193) hide show
  1. package/dist/applicants/applicant-commitment-creditCard.model.d.ts +26 -0
  2. package/dist/applicants/applicant-commitment-creditCard.model.d.ts.map +1 -1
  3. package/dist/applicants/applicant-commitment-loan.model.d.ts +26 -0
  4. package/dist/applicants/applicant-commitment-loan.model.d.ts.map +1 -1
  5. package/dist/applicants/applicant-commitment-mortgage.model.d.ts +26 -0
  6. package/dist/applicants/applicant-commitment-mortgage.model.d.ts.map +1 -1
  7. package/dist/applicants/applicant-commitment-residence.model.d.ts +26 -0
  8. package/dist/applicants/applicant-commitment-residence.model.d.ts.map +1 -1
  9. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts +26 -0
  10. package/dist/applicants/applicant-commitment-secureLoan.model.d.ts.map +1 -1
  11. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts +26 -0
  12. package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts.map +1 -1
  13. package/dist/applicants/applicant-credit-data.model.d.ts +27 -0
  14. package/dist/applicants/applicant-credit-data.model.d.ts.map +1 -1
  15. package/dist/applicants/applicant-credit-profile.model.d.ts +27 -0
  16. package/dist/applicants/applicant-credit-profile.model.d.ts.map +1 -1
  17. package/dist/applicants/applicant-direct-debit.model.d.ts +27 -0
  18. package/dist/applicants/applicant-direct-debit.model.d.ts.map +1 -1
  19. package/dist/applicants/applicant-employment-income.model.d.ts +201 -0
  20. package/dist/applicants/applicant-employment-income.model.d.ts.map +1 -0
  21. package/dist/applicants/applicant-employment-income.model.js +9 -0
  22. package/dist/applicants/applicant-employment.model.d.ts +26 -18
  23. package/dist/applicants/applicant-employment.model.d.ts.map +1 -1
  24. package/dist/applicants/applicant-employment.model.js +0 -6
  25. package/dist/applicants/applicant-expenditure.model.d.ts +99 -50
  26. package/dist/applicants/applicant-expenditure.model.d.ts.map +1 -1
  27. package/dist/applicants/applicant-expenditure.model.js +49 -18
  28. package/dist/applicants/applicant-income-source.model.d.ts +27 -0
  29. package/dist/applicants/applicant-income-source.model.d.ts.map +1 -1
  30. package/dist/applicants/applicant-income.model.d.ts +38 -0
  31. package/dist/applicants/applicant-income.model.d.ts.map +1 -1
  32. package/dist/applicants/applicant-income.model.js +5 -1
  33. package/dist/applicants/applicant-other-income.model.d.ts +26 -0
  34. package/dist/applicants/applicant-other-income.model.d.ts.map +1 -1
  35. package/dist/applicants/applicant-property-income.model.d.ts +26 -0
  36. package/dist/applicants/applicant-property-income.model.d.ts.map +1 -1
  37. package/dist/applicants/applicant-risk-narrative.model.d.ts +27 -0
  38. package/dist/applicants/applicant-risk-narrative.model.d.ts.map +1 -1
  39. package/dist/applicants/applicant.model.d.ts +716 -3096
  40. package/dist/applicants/applicant.model.d.ts.map +1 -1
  41. package/dist/applicants/applicant.model.js +0 -2
  42. package/dist/applicants/index.d.ts +2 -0
  43. package/dist/applicants/index.d.ts.map +1 -1
  44. package/dist/applicants/index.js +2 -0
  45. package/dist/applications/application-audit.model.d.ts +27 -0
  46. package/dist/applications/application-audit.model.d.ts.map +1 -1
  47. package/dist/applications/application-checklist-Item.model.d.ts +27 -0
  48. package/dist/applications/application-checklist-Item.model.d.ts.map +1 -1
  49. package/dist/applications/application-company-model.d.ts +26 -0
  50. package/dist/applications/application-company-model.d.ts.map +1 -1
  51. package/dist/applications/application-credit-profile.model.d.ts +27 -0
  52. package/dist/applications/application-credit-profile.model.d.ts.map +1 -1
  53. package/dist/applications/application-direct-debit.model.d.ts +26 -0
  54. package/dist/applications/application-direct-debit.model.d.ts.map +1 -1
  55. package/dist/applications/application-document.model.d.ts +27 -0
  56. package/dist/applications/application-document.model.d.ts.map +1 -1
  57. package/dist/applications/application-fieldconfig.model.d.ts +27 -0
  58. package/dist/applications/application-fieldconfig.model.d.ts.map +1 -1
  59. package/dist/applications/application-illustration-model.d.ts +27 -0
  60. package/dist/applications/application-illustration-model.d.ts.map +1 -1
  61. package/dist/applications/application-legal.model.d.ts +27 -0
  62. package/dist/applications/application-legal.model.d.ts.map +1 -1
  63. package/dist/applications/application-mortgage.model.d.ts +26 -0
  64. package/dist/applications/application-mortgage.model.d.ts.map +1 -1
  65. package/dist/applications/application-note.model.d.ts +27 -0
  66. package/dist/applications/application-note.model.d.ts.map +1 -1
  67. package/dist/applications/application-offer.model.d.ts +27 -0
  68. package/dist/applications/application-offer.model.d.ts.map +1 -1
  69. package/dist/applications/application-onboarding.model.d.ts +27 -0
  70. package/dist/applications/application-onboarding.model.d.ts.map +1 -1
  71. package/dist/applications/application-product.model.d.ts +27 -0
  72. package/dist/applications/application-product.model.d.ts.map +1 -1
  73. package/dist/applications/application-rationale.model.d.ts +27 -0
  74. package/dist/applications/application-rationale.model.d.ts.map +1 -1
  75. package/dist/applications/application-risk-narrative.model.d.ts +27 -0
  76. package/dist/applications/application-risk-narrative.model.d.ts.map +1 -1
  77. package/dist/applications/application-valuation.model.d.ts +27 -0
  78. package/dist/applications/application-valuation.model.d.ts.map +1 -1
  79. package/dist/applications/application.model.d.ts +27 -0
  80. package/dist/applications/application.model.d.ts.map +1 -1
  81. package/dist/applications/broker.model.d.ts +27 -0
  82. package/dist/applications/broker.model.d.ts.map +1 -1
  83. package/dist/applications/document.model.d.ts +27 -0
  84. package/dist/applications/document.model.d.ts.map +1 -1
  85. package/dist/applications/productfeatures.model.d.ts +27 -0
  86. package/dist/applications/productfeatures.model.d.ts.map +1 -1
  87. package/dist/applications/solicitor.model.d.ts +26 -0
  88. package/dist/applications/solicitor.model.d.ts.map +1 -1
  89. package/dist/entities/applicants/applicant.entity.d.ts +0 -3
  90. package/dist/entities/applicants/applicant.entity.d.ts.map +1 -1
  91. package/dist/entities/applicants/applicant.entity.js +0 -3
  92. package/dist/entities/applicants/employment.entity.d.ts +1 -3
  93. package/dist/entities/applicants/employment.entity.d.ts.map +1 -1
  94. package/dist/entities/applicants/employment.entity.js +1 -9
  95. package/dist/entities/applications/company.entity.d.ts +2 -2
  96. package/dist/entities/applications/solicitor.entity.d.ts +1 -1
  97. package/dist/entities/properties/property.entity.d.ts +2 -2
  98. package/dist/entities/properties/property.entity.d.ts.map +1 -1
  99. package/dist/product-catalogues/product-catalogue.model.d.ts +27 -0
  100. package/dist/product-catalogues/product-catalogue.model.d.ts.map +1 -1
  101. package/dist/product-catalogues/product-definitions.model.d.ts +27 -0
  102. package/dist/product-catalogues/product-definitions.model.d.ts.map +1 -1
  103. package/dist/product-catalogues/product-variant.model.d.ts +27 -0
  104. package/dist/product-catalogues/product-variant.model.d.ts.map +1 -1
  105. package/dist/properties/property.model.d.ts +26 -0
  106. package/dist/properties/property.model.d.ts.map +1 -1
  107. package/dist/properties/security.model.d.ts +27 -0
  108. package/dist/properties/security.model.d.ts.map +1 -1
  109. package/dist/shared/alert.model.d.ts +27 -0
  110. package/dist/shared/alert.model.d.ts.map +1 -1
  111. package/dist/shared/apprivo-sync-journey.model.d.ts +27 -0
  112. package/dist/shared/apprivo-sync-journey.model.d.ts.map +1 -1
  113. package/dist/shared/checklist.model.d.ts +27 -0
  114. package/dist/shared/checklist.model.d.ts.map +1 -1
  115. package/dist/shared/document-type-model.d.ts +27 -0
  116. package/dist/shared/document-type-model.d.ts.map +1 -1
  117. package/dist/shared/job-run.model.d.ts +27 -0
  118. package/dist/shared/job-run.model.d.ts.map +1 -1
  119. package/dist/shared/job-setting.model.d.ts +27 -0
  120. package/dist/shared/job-setting.model.d.ts.map +1 -1
  121. package/dist/shared/lookup-group.model.d.ts +27 -0
  122. package/dist/shared/lookup-group.model.d.ts.map +1 -1
  123. package/dist/shared/lookup.model.d.ts +27 -0
  124. package/dist/shared/lookup.model.d.ts.map +1 -1
  125. package/dist/shared/schema-doc.model.d.ts +27 -0
  126. package/dist/shared/schema-doc.model.d.ts.map +1 -1
  127. package/dist/shared/system-parameter.model.d.ts +27 -0
  128. package/dist/shared/system-parameter.model.d.ts.map +1 -1
  129. package/dist/shared/task-document.model.d.ts +27 -0
  130. package/dist/shared/task-document.model.d.ts.map +1 -1
  131. package/dist/shared/task.model.d.ts +27 -0
  132. package/dist/shared/task.model.d.ts.map +1 -1
  133. package/dist/underwriter/underwriter.model.d.ts +27 -0
  134. package/dist/underwriter/underwriter.model.d.ts.map +1 -1
  135. package/dist/users/auth-log.model.d.ts +27 -0
  136. package/dist/users/auth-log.model.d.ts.map +1 -1
  137. package/dist/users/permission.model.d.ts +27 -0
  138. package/dist/users/permission.model.d.ts.map +1 -1
  139. package/dist/users/role-group.model.d.ts +27 -0
  140. package/dist/users/role-group.model.d.ts.map +1 -1
  141. package/dist/users/role.model.d.ts +27 -0
  142. package/dist/users/role.model.d.ts.map +1 -1
  143. package/dist/users/tasks.model.d.ts +27 -0
  144. package/dist/users/tasks.model.d.ts.map +1 -1
  145. package/dist/users/user.model.d.ts +27 -0
  146. package/dist/users/user.model.d.ts.map +1 -1
  147. package/dist/value-objects/pound.d.ts +26 -0
  148. package/dist/value-objects/pound.d.ts.map +1 -1
  149. package/dist/value-objects/sort-code.d.ts +26 -0
  150. package/dist/value-objects/sort-code.d.ts.map +1 -1
  151. package/entities/applicants/{credit-data.entity.ts → applicant-credit-data.entity.ts} +2 -2
  152. package/entities/{applications/credit-profile.entity.ts → applicants/applicant-credit-profile.entity.ts} +8 -2
  153. package/entities/applicants/applicant-employment-income.entity.ts +14 -0
  154. package/entities/applicants/{employment.entity.ts → applicant-employment.entity.ts} +1 -17
  155. package/entities/applicants/applicant-expenditure.entity.ts +15 -0
  156. package/entities/applicants/{income-source.entity.ts → applicant-income-source.entity.ts} +2 -2
  157. package/entities/applicants/{income.entity.ts → applicant-income.entity.ts} +9 -6
  158. package/entities/applicants/applicant.entity.ts +11 -17
  159. package/entities/applicants/index.ts +6 -6
  160. package/entities/{applicants/credit-profile.entity.ts → applications/application-credit-profile.entity.ts} +2 -2
  161. package/entities/applications/application-rationale.entity.ts +1 -1
  162. package/entities/applications/company.entity.ts +2 -1
  163. package/entities/applications/index.ts +1 -1
  164. package/entities/applications/solicitor.entity.ts +1 -1
  165. package/entities/properties/property.entity.ts +2 -2
  166. package/package.json +2 -2
  167. package/prisma/applicants/{credit-data.prisma → applicant-credit-data.prisma} +2 -2
  168. package/prisma/applicants/{credit-profile.prisma → applicant-credit-profile.prisma} +3 -2
  169. package/prisma/applicants/applicant-employment-income.prisma +14 -0
  170. package/prisma/applicants/applicant-employment.prisma +54 -0
  171. package/prisma/applicants/applicant-expenditure.prisma +14 -0
  172. package/prisma/applicants/{income-source.prisma → applicant-income-source.prisma} +2 -2
  173. package/prisma/applicants/{income.prisma → applicant-income.prisma} +10 -5
  174. package/prisma/applicants/{other-income.prisma → applicant-other-income.prisma} +2 -2
  175. package/prisma/applicants/{property-income.prisma → applicant-property-income.prisma} +3 -2
  176. package/prisma/applicants/applicant.prisma +10 -10
  177. package/prisma/applications/{credit-profile.prisma → application-credit-profile.prisma} +6 -2
  178. package/prisma/applications/application.prisma +1 -1
  179. package/prisma/migrations/{20250430124915_initial_migration → 20250501070203_initial_migration}/migration.sql +309 -382
  180. package/prisma/schema.prisma +1187 -1258
  181. package/prisma/shared/lookup.prisma +17 -26
  182. package/entities/applicants/direct-debit.entity.ts +0 -30
  183. package/entities/applicants/expenditure.entity.ts +0 -29
  184. package/entities/applicants/risk-narrative.entity.ts +0 -28
  185. package/entities/applications/application-risk-narrative.entity.ts +0 -22
  186. package/entities/applications/application-valuation.entity.ts +0 -20
  187. package/prisma/applicants/direct-debit.prisma +0 -26
  188. package/prisma/applicants/employment.prisma +0 -59
  189. package/prisma/applicants/expenditure.prisma +0 -26
  190. package/prisma/applicants/risk-narrative.prisma +0 -23
  191. package/prisma/applications/application-risk-narrative.prisma +0 -18
  192. package/prisma/applications/application-valuation.prisma +0 -18
  193. package/prisma/lookup.entity.ts +0 -9
@@ -1,4 +1,4 @@
1
- model CreditProfile {
1
+ model ApplicantCreditProfile {
2
2
  id String @id @default(uuid())
3
3
  anyVoluntaryEnforcedPossessionNo String @map("any_voluntary_enforced_possession_no")
4
4
  bankruptcyNo String @map("bankruptcy_no")
@@ -6,9 +6,10 @@ model CreditProfile {
6
6
  defaultsInLastYearNo String @map("defaults_in_last_year_no")
7
7
  createdAt DateTime @default(now()) @map("created_at")
8
8
  updatedAt DateTime @updatedAt @map("updated_at")
9
+ applicantId String @unique @map("applicant_id")
9
10
 
10
11
  // Relations
11
- applicants Applicant[] @relation("ApplicantCreditProfile")
12
+ applicant Applicant @relation("ApplicantCreditProfile", fields: [applicantId], references: [id])
12
13
 
13
14
  @@map("applicant_credit_profiles")
14
15
  }
@@ -0,0 +1,14 @@
1
+ model ApplicantEmploymentIncome {
2
+ id String @id @default(uuid())
3
+ applicantId String @unique @map("applicant_id")
4
+ incomeTypeLid String @map("income_type_lid")
5
+ amount Decimal @map("amount")
6
+ createdAt DateTime @default(now()) @map("created_at")
7
+ updatedAt DateTime @updatedAt @map("updated_at")
8
+
9
+ // Relations
10
+ applicant Applicant @relation("ApplicantEmploymentIncome", fields: [applicantId], references: [id])
11
+ incomeType Lookup @relation("ApplicantEmploymentIncomeType", fields: [incomeTypeLid], references: [id])
12
+
13
+ @@map("applicant_employment_incomes")
14
+ }
@@ -0,0 +1,54 @@
1
+ model ApplicantEmployment {
2
+ id String @id @default(uuid())
3
+ pageValidFlag Boolean @default(false) @map("page_valid_flag")
4
+ acceptableIncomeLids String[] @map("acceptable_income_lids")
5
+ addressCity String? @map("address_city")
6
+ addressCountryLid String @map("address_country_lid")
7
+ addressLine1 String @map("address_line1")
8
+ addressLine2 String? @map("address_line2")
9
+ addressLine3 String? @map("address_line3")
10
+ addressPostCode String @map("address_post_code")
11
+ averageBonusPreviousTwoYears Decimal @default(0.00) @map("average_bonus_previous_two_years")
12
+ basicGrossIncome Decimal @default(0.00) @map("basic_gross_income")
13
+ contractRemaining String? @map("contract_remaining")
14
+ dateJoined String @map("date_joined")
15
+ disabilityLiving Decimal @default(0.00) @map("disability_living")
16
+ employerName String @map("employer_name")
17
+ employerTelephone String? @map("employer_telephone")
18
+ housingAllowance Decimal @default(0.00) @map("housing_allowance")
19
+ industryLid String @map("industry_lid")
20
+ isUnderTerminationNotice Boolean @default(false) @map("is_under_termination_notice")
21
+ jobTitleLid String @map("job_title_lid")
22
+ maintenance Decimal @default(0.00) @map("maintenance")
23
+ maternityIncome Decimal @default(0.00) @map("maternity_income")
24
+ natureOfBusiness String @map("nature_of_business")
25
+ pensionIncome Decimal @default(0.00) @map("pension_income")
26
+ previousAddressCity String? @map("previous_address_city")
27
+ previousAddressCountry String @map("previous_address_country")
28
+ previousAddressLine1 String @map("previous_address_line1")
29
+ previousAddressLine2 String? @map("previous_address_line2")
30
+ previousAddressLine3 String? @map("previous_address_line3")
31
+ previousAddressPostCode String @map("previous_address_post_code")
32
+ previousBasicGrossIncome Decimal @default(0.00) @map("previous_basic_gross_income")
33
+ previousDateJoined String @map("previous_date_joined")
34
+ previousDateLeft String @map("previous_date_left")
35
+ previousEmployerName String @map("previous_employer_name")
36
+ previousEmployerTelephone String? @map("previous_employer_telephone")
37
+ previousJobTitle String @map("previous_job_title")
38
+ previousNatureOfBusiness String @map("previous_nature_of_business")
39
+ referenceContact String? @map("reference_contact")
40
+ referenceContactEmail String @map("reference_contact_email")
41
+ underTerminationNoticeNote String? @map("under_termination_notice_note")
42
+ applicantId String @unique @map("applicant_id")
43
+ createdAt DateTime @default(now()) @map("created_at")
44
+ updatedAt DateTime @updatedAt @map("updated_at")
45
+
46
+ // Relations
47
+ applicant Applicant @relation("ApplicantEmployment", fields: [applicantId], references: [id])
48
+ addressCountry Lookup @relation("AddressCountry", fields: [addressCountryLid], references: [id])
49
+ industry Lookup @relation("Industry", fields: [industryLid], references: [id])
50
+ jobTitle Lookup @relation("JobTitle", fields: [jobTitleLid], references: [id])
51
+ acceptableIncomeTypes Lookup[] @relation("AcceptableIncomeTypes")
52
+
53
+ @@map("applicant_employments")
54
+ }
@@ -0,0 +1,14 @@
1
+ model ApplicantExpenditure {
2
+ id String @id @default(uuid())
3
+ applicantId String @map("applicant_id")
4
+ expenditureTypeLid String @map("expenditure_type_lid")
5
+ amount Decimal @map("amount")
6
+ createdAt DateTime @default(now()) @map("created_at")
7
+ updatedAt DateTime @updatedAt @map("updated_at")
8
+
9
+ // Relations
10
+ applicant Applicant @relation("ApplicantExpenditures",fields: [applicantId], references: [id])
11
+ expenditureType Lookup @relation("ExpenditureType", fields: [expenditureTypeLid], references: [id])
12
+
13
+ @@map("applicant_expenditures")
14
+ }
@@ -1,4 +1,4 @@
1
- model IncomeSource {
1
+ model ApplicantIncomeSource {
2
2
  id String @id @default(uuid())
3
3
  employmentStatusLid String? @map("employment_status_lid")
4
4
  incomeFromEmployment String?
@@ -10,7 +10,7 @@ model IncomeSource {
10
10
  updatedAt DateTime @updatedAt @map("updated_at")
11
11
 
12
12
  // Relations
13
- applicant Applicant @relation(fields: [applicantId], references: [id])
13
+ applicant Applicant @relation("ApplicantIncomeSource", fields: [applicantId], references: [id])
14
14
  employmentStatus Lookup? @relation("IncomeSourceEmploymentStatus", fields: [employmentStatusLid], references: [id])
15
15
 
16
16
  @@map("applicant_income_source")
@@ -1,5 +1,6 @@
1
- model Income {
1
+ model ApplicantIncome {
2
2
  id String @id @default(uuid())
3
+ applicantId String @map("applicant_id")
3
4
  accountantsAddressLine1 String @map("accountants_address_line1")
4
5
  accountantsAddressLine2 String @map("accountants_address_line2")
5
6
  accountantsAddressLine3 String @map("accountants_address_line3")
@@ -47,6 +48,10 @@ model Income {
47
48
  yearEnd1 Int? @map("year_end1")
48
49
  yearEnd2 Int? @map("year_end2")
49
50
  yearEnd3 Int? @map("year_end3")
51
+ totalEmploymentGrossIncome Decimal @map("total_employment_gross_income")
52
+ totalEmploymentNetIncome Decimal @map("total_employment_net_income")
53
+ isEmploymentIncomeConfirmed Boolean @map("is_employment_income_confirmed")
54
+ employmentIncomeRationale String
50
55
  createdAt DateTime @default(now()) @map("created_at")
51
56
  updatedAt DateTime @updatedAt @map("updated_at")
52
57
 
@@ -56,7 +61,7 @@ model Income {
56
61
  businessType Lookup @relation("BusinessType", fields: [businessTypeLid], references: [id])
57
62
  charteredCertifiedOrOther Lookup @relation("CharteredCertifiedOrOther", fields: [charteredCertifiedOrOtherLid], references: [id])
58
63
  registeredCountry Lookup @relation("RegisteredCountry", fields: [registeredCountryLid], references: [id])
59
- applicants Applicant[] @relation("ApplicantIncome")
60
-
61
- @@map("applicant_income")
62
- }
64
+ applicant Applicant @relation("ApplicantIncome", fields: [applicantId], references: [id])
65
+
66
+ @@map("applicant_incomes")
67
+ }
@@ -1,4 +1,4 @@
1
- model OtherIncome {
1
+ model ApplicantOtherIncome {
2
2
  id String @id @default(uuid())
3
3
  // Income Source 1
4
4
  sourceDetails1 String?
@@ -35,7 +35,7 @@ model OtherIncome {
35
35
  updatedAt DateTime @updatedAt @map("updated_at")
36
36
 
37
37
  // Relations
38
- applicant Applicant @relation(fields: [applicantId], references: [id])
38
+ applicant Applicant @relation("ApplicantOtherIncome", fields: [applicantId], references: [id])
39
39
  payFrequency1 Lookup? @relation("PayFrequency1", fields: [payFrequency1Lid], references: [id])
40
40
  payFrequency2 Lookup? @relation("PayFrequency2", fields: [payFrequency2Lid], references: [id])
41
41
  payFrequency3 Lookup? @relation("PayFrequency3", fields: [payFrequency3Lid], references: [id])
@@ -1,4 +1,4 @@
1
- model PropertyIncome {
1
+ model ApplicantPropertyIncome {
2
2
  id String @id @default(uuid())
3
3
  pageValidFlag Boolean @default(false) @map("page_valid_flag")
4
4
  yearEnd1 String @map("year_end_1")
@@ -10,11 +10,12 @@ model PropertyIncome {
10
10
  yearEnd3 String @map("year_end_3")
11
11
  rentalIncome3 Decimal @map("rental_income_3")
12
12
  netProfit3 Decimal @map("net_profit_3")
13
+ applicantId String @unique @map("applicant_id")
13
14
  createdAt DateTime @default(now()) @map("created_at")
14
15
  updatedAt DateTime @updatedAt @map("updated_at")
15
16
 
16
17
  // Relations
17
- applicants Applicant[] @relation("ApplicantPropertyIncome")
18
+ applicant Applicant @relation("ApplicantPropertyIncome", fields: [applicantId], references: [id])
18
19
 
19
20
  @@map("applicant_property_income")
20
21
  }
@@ -108,16 +108,16 @@ model Applicant {
108
108
  taxPayer Lookup @relation("TaxPayer", fields: [taxPayerLid], references: [id])
109
109
  ukPassportProfession Lookup? @relation("UkPassportProfession", fields: [ukPassportProfessionLid], references: [id])
110
110
  vulnerabilityTypes Lookup[] @relation("VulnerabilityTypes")
111
- creditData CreditData?
112
- riskNarrative RiskNarrative?
113
- otherIncome OtherIncome?
114
- incomeSource IncomeSource?
115
- expenditure Expenditure?
116
- employment Employment?
117
- directDebit DirectDebit?
118
- creditProfile CreditProfile? @relation("ApplicantCreditProfile", fields: [id], references: [id], map: "applicant_credit_profile_fkey")
119
- propertyIncome PropertyIncome? @relation("ApplicantPropertyIncome", fields: [id], references: [id], map: "applicant_property_income_fkey")
120
- income Income? @relation("ApplicantIncome", fields: [id], references: [id], map: "applicant_income_fkey")
111
+ otherIncome ApplicantOtherIncome? @relation("ApplicantOtherIncome")
112
+ incomeSource ApplicantIncomeSource? @relation("ApplicantIncomeSource")
113
+ creditProfile ApplicantCreditProfile? @relation("ApplicantCreditProfile")
114
+ propertyIncome ApplicantPropertyIncome? @relation("ApplicantPropertyIncome")
115
+
116
+ employment ApplicantEmployment? @relation("ApplicantEmployment")
117
+ creditData ApplicantCreditData? @relation("ApplicantCreditData")
118
+ employmentIncome ApplicantEmploymentIncome? @relation("ApplicantEmploymentIncome")
119
+ expenditures ApplicantExpenditure[] @relation("ApplicantExpenditures")
120
+ incomes ApplicantIncome[] @relation("ApplicantIncome")
121
121
  creditCardCommitments CreditCardCommitment[] @relation("ApplicantCreditCardCommitments")
122
122
  loanCommitments LoanCommitment[] @relation("ApplicantLoanCommitments")
123
123
  mortgageCommitments MortgageCommitment[] @relation("ApplicantMortgageCommitments")
@@ -1,11 +1,15 @@
1
- model CreditProfile {
1
+ model ApplicationCreditProfile {
2
2
  id String @id @default(uuid())
3
3
  anyVoluntaryEnforcedPossessionNo String @map("any_voluntary_enforced_possession_no")
4
4
  bankruptcyNo String @map("bankruptcy_no")
5
5
  ccjInLastThreeYearNo String @map("ccj_in_last_three_year_no")
6
6
  defaultsInLastYearNo String @map("defaults_in_last_year_no")
7
+ applicationId String @unique @map("application_id")
7
8
  createdAt DateTime @default(now()) @map("created_at")
8
9
  updatedAt DateTime @updatedAt @map("updated_at")
9
10
 
10
- @@map("credit_profiles")
11
+ // Relations
12
+ application Application @relation("ApplicationCreditProfile", fields: [applicationId], references: [id])
13
+
14
+ @@map("application_credit_profiles")
11
15
  }
@@ -70,6 +70,7 @@ model Application {
70
70
  solicitor Solicitor?
71
71
  product Product? @relation(fields: [productId], references: [id])
72
72
  directDebit ApplicationDirectDebit? @relation("ApplicationDirectDebit")
73
+ creditProfile ApplicationCreditProfile? @relation("ApplicationCreditProfile")
73
74
  mortgage ApplicationMortgage? @relation("ApplicationMortgage")
74
75
  company ApplicationCompany? @relation("ApplicationCompany")
75
76
  rationale ApplicationRationale? @relation("ApplicationRationale")
@@ -80,7 +81,6 @@ model Application {
80
81
  audits ApplicationAudit[]
81
82
  underwriters Underwriter[] @relation("ApplicationUnderwriters")
82
83
  status Lookup @relation("Status", fields: [statusLid], references: [id])
83
- directDebits DirectDebit[] @relation("ApplicationDirectDebits")
84
84
  products ApplicationProduct[] @relation("ApplicationProducts")
85
85
  companies Company[] @relation("ApplicationCompany")
86
86