@dynamatix/gb-schemas 2.0.0 → 2.0.1
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.
- package/entities/applications/application-rationale.entity.ts +1 -1
- package/entities/applications/company.entity.ts +1 -2
- package/entities/applications/solicitor.entity.ts +1 -1
- package/entities/properties/property.entity.ts +1 -1
- package/package.json +1 -1
- package/prisma/applicants/applicant.prisma +10 -5
- package/prisma/applicants/credit-card-commitment.prisma +1 -1
- package/prisma/applicants/credit-data.prisma +1 -1
- package/prisma/applicants/credit-profile.prisma +1 -1
- package/prisma/applicants/direct-debit.prisma +2 -1
- package/prisma/applicants/income-source.prisma +1 -1
- package/prisma/applicants/income.prisma +3 -2
- package/prisma/applicants/loan-commitment.prisma +2 -1
- package/prisma/applicants/mortgage-commitment.prisma +7 -6
- package/prisma/applicants/property-income.prisma +17 -14
- package/prisma/applicants/residence-commitment.prisma +7 -6
- package/prisma/applicants/secured-loan-commitment.prisma +1 -1
- package/prisma/applicants/unsecured-loan-commitment.prisma +1 -1
- package/prisma/applications/application-company.prisma +7 -5
- package/prisma/applications/application-direct-debit.prisma +7 -5
- package/prisma/applications/application-mortgage.prisma +1 -1
- package/prisma/applications/application-product.prisma +1 -1
- package/prisma/applications/application-rationale.prisma +1 -1
- package/prisma/applications/application.prisma +28 -12
- package/prisma/applications/broker.prisma +4 -0
- package/prisma/applications/company.prisma +7 -7
- package/prisma/broker.entity.ts +8 -0
- package/prisma/lookup.entity.ts +9 -0
- package/prisma/migrations/{20250430085825_initial_migration → 20250430124915_initial_migration}/migration.sql +69 -42
- package/prisma/properties/property.prisma +1 -1
- package/prisma/schema.prisma +215 -198
- package/prisma/shared/alert.prisma +1 -1
- package/prisma/shared/lookup.prisma +4 -0
- package/prisma/underwriter/underwriter.prisma +2 -2
- package/prisma/users/user.prisma +2 -2
package/package.json
CHANGED
|
@@ -108,8 +108,6 @@ 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
|
-
|
|
112
|
-
// Nested schemas
|
|
113
111
|
creditData CreditData?
|
|
114
112
|
riskNarrative RiskNarrative?
|
|
115
113
|
otherIncome OtherIncome?
|
|
@@ -117,9 +115,16 @@ model Applicant {
|
|
|
117
115
|
expenditure Expenditure?
|
|
118
116
|
employment Employment?
|
|
119
117
|
directDebit DirectDebit?
|
|
120
|
-
creditProfile
|
|
121
|
-
propertyIncome
|
|
122
|
-
income
|
|
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")
|
|
121
|
+
creditCardCommitments CreditCardCommitment[] @relation("ApplicantCreditCardCommitments")
|
|
122
|
+
loanCommitments LoanCommitment[] @relation("ApplicantLoanCommitments")
|
|
123
|
+
mortgageCommitments MortgageCommitment[] @relation("ApplicantMortgageCommitments")
|
|
124
|
+
residenceCommitments ResidenceCommitment[] @relation("ApplicantResidenceCommitments")
|
|
125
|
+
securedLoanCommitments SecuredLoanCommitment[] @relation("ApplicantSecuredLoanCommitments")
|
|
126
|
+
unsecuredLoanCommitments UnsecuredLoanCommitment[] @relation("ApplicantUnsecuredLoanCommitments")
|
|
127
|
+
shareholdings ApplicantShareholding[] @relation("ApplicantShareholdings")
|
|
123
128
|
|
|
124
129
|
@@map("applicants")
|
|
125
130
|
}
|
|
@@ -13,7 +13,7 @@ model CreditCardCommitment {
|
|
|
13
13
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
14
14
|
|
|
15
15
|
// Relations
|
|
16
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
16
|
+
applicant Applicant @relation("ApplicantCreditCardCommitments", fields: [applicantId], references: [id])
|
|
17
17
|
commitmentType Lookup? @relation("CommitmentType", fields: [commitmentTypeLid], references: [id])
|
|
18
18
|
repaymentType Lookup @relation("CreditCardRepaymentType", fields: [creditCardRepaymentTypeLid], references: [id])
|
|
19
19
|
|
|
@@ -13,7 +13,7 @@ model CreditData {
|
|
|
13
13
|
|
|
14
14
|
// Relations
|
|
15
15
|
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
16
|
-
status Lookup @relation(fields: [statusLid], references: [id])
|
|
16
|
+
status Lookup @relation("CreditDataStatus", fields: [statusLid], references: [id])
|
|
17
17
|
|
|
18
18
|
@@map("applicant_credit_data")
|
|
19
19
|
}
|
|
@@ -13,13 +13,14 @@ model DirectDebit {
|
|
|
13
13
|
nameOfAccountHolder String?
|
|
14
14
|
selectedPaymentDay String?
|
|
15
15
|
sortCode String?
|
|
16
|
+
telephone String?
|
|
16
17
|
applicantId String @unique @map("applicant_id")
|
|
17
18
|
createdAt DateTime @default(now()) @map("created_at")
|
|
18
19
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
19
20
|
|
|
20
21
|
// Relations
|
|
21
22
|
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
22
|
-
application Application @relation(fields: [applicationId], references: [id])
|
|
23
|
+
application Application @relation("ApplicationDirectDebits", fields: [applicationId], references: [id])
|
|
23
24
|
|
|
24
25
|
@@map("applicant_direct_debit")
|
|
25
26
|
}
|
|
@@ -11,7 +11,7 @@ model IncomeSource {
|
|
|
11
11
|
|
|
12
12
|
// Relations
|
|
13
13
|
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
14
|
-
employmentStatus Lookup? @relation(fields: [employmentStatusLid], references: [id])
|
|
14
|
+
employmentStatus Lookup? @relation("IncomeSourceEmploymentStatus", fields: [employmentStatusLid], references: [id])
|
|
15
15
|
|
|
16
16
|
@@map("applicant_income_source")
|
|
17
17
|
}
|
|
@@ -28,7 +28,7 @@ model Income {
|
|
|
28
28
|
netAssets1 Decimal @default(0.00) @map("net_assets1")
|
|
29
29
|
netAssets2 Decimal @default(0.00) @map("net_assets2")
|
|
30
30
|
netAssets3 Decimal @default(0.00) @map("net_assets3")
|
|
31
|
-
pageValidFlag Boolean @default(
|
|
31
|
+
pageValidFlag Boolean @default(false) @map("page_valid_flag")
|
|
32
32
|
percentageOfShareholding Int @map("percentage_of_shareholding")
|
|
33
33
|
registeredAddressLine1 String @map("registered_address_line1")
|
|
34
34
|
registeredAddressLine2 String @map("registered_address_line2")
|
|
@@ -56,6 +56,7 @@ model Income {
|
|
|
56
56
|
businessType Lookup @relation("BusinessType", fields: [businessTypeLid], references: [id])
|
|
57
57
|
charteredCertifiedOrOther Lookup @relation("CharteredCertifiedOrOther", fields: [charteredCertifiedOrOtherLid], references: [id])
|
|
58
58
|
registeredCountry Lookup @relation("RegisteredCountry", fields: [registeredCountryLid], references: [id])
|
|
59
|
+
applicants Applicant[] @relation("ApplicantIncome")
|
|
59
60
|
|
|
60
|
-
@@map("
|
|
61
|
+
@@map("applicant_income")
|
|
61
62
|
}
|
|
@@ -13,11 +13,12 @@ model LoanCommitment {
|
|
|
13
13
|
startDate String @map("start_date")
|
|
14
14
|
outstandingBalance Decimal @map("outstanding_balance")
|
|
15
15
|
monthlyPayment Decimal @map("monthly_payment")
|
|
16
|
+
jointNames Boolean @map("joint_names")
|
|
16
17
|
createdAt DateTime @default(now()) @map("created_at")
|
|
17
18
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
18
19
|
|
|
19
20
|
// Relations
|
|
20
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
21
|
+
applicant Applicant @relation("ApplicantLoanCommitments", fields: [applicantId], references: [id])
|
|
21
22
|
commitmentType Lookup? @relation("CommitmentType", fields: [commitmentTypeLid], references: [id])
|
|
22
23
|
loanType Lookup @relation("LoanType", fields: [loanTypeLid], references: [id])
|
|
23
24
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
model MortgageCommitment {
|
|
2
2
|
id String @id @default(uuid())
|
|
3
3
|
applicantId String @map("applicant_id")
|
|
4
|
-
lenderName String
|
|
5
|
-
propertyValue Decimal
|
|
4
|
+
lenderName String @map("lender_name")
|
|
5
|
+
propertyValue Decimal @map("property_value")
|
|
6
6
|
repaymentTypeLid String @map("repayment_type_lid")
|
|
7
7
|
mortgageTypeLid String? @map("mortgage_type_lid")
|
|
8
8
|
fixedTerm String
|
|
9
9
|
originalLoanAmount Decimal
|
|
10
|
-
outstandingBalance Decimal
|
|
10
|
+
outstandingBalance Decimal @map("outstanding_balance")
|
|
11
11
|
startDate String
|
|
12
|
-
monthlyPayment Decimal
|
|
13
|
-
commitmentId String
|
|
12
|
+
monthlyPayment Decimal @map("monthly_payment")
|
|
13
|
+
commitmentId String @map("commitment_id")
|
|
14
14
|
commitmentTypeLid String? @map("commitment_type_lid")
|
|
15
15
|
furtherAdvances Boolean
|
|
16
16
|
furtherAdvanceDetails String
|
|
@@ -20,11 +20,12 @@ model MortgageCommitment {
|
|
|
20
20
|
accountInArrearsDetails String
|
|
21
21
|
doHaveSharedResponsibility Boolean
|
|
22
22
|
sharedMortgage String
|
|
23
|
+
jointNames Boolean @map("joint_names")
|
|
23
24
|
createdAt DateTime @default(now()) @map("created_at")
|
|
24
25
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
25
26
|
|
|
26
27
|
// Relations
|
|
27
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
28
|
+
applicant Applicant @relation("ApplicantMortgageCommitments", fields: [applicantId], references: [id])
|
|
28
29
|
repaymentType Lookup @relation("RepaymentType", fields: [repaymentTypeLid], references: [id])
|
|
29
30
|
mortgageType Lookup? @relation("MortgageType", fields: [mortgageTypeLid], references: [id])
|
|
30
31
|
commitmentType Lookup? @relation("CommitmentType", fields: [commitmentTypeLid], references: [id])
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
model PropertyIncome {
|
|
2
|
-
id
|
|
3
|
-
pageValidFlag
|
|
4
|
-
yearEnd1
|
|
5
|
-
rentalIncome1
|
|
6
|
-
netProfit1
|
|
7
|
-
yearEnd2
|
|
8
|
-
rentalIncome2
|
|
9
|
-
netProfit2
|
|
10
|
-
yearEnd3
|
|
11
|
-
rentalIncome3
|
|
12
|
-
netProfit3
|
|
13
|
-
createdAt
|
|
14
|
-
updatedAt
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
pageValidFlag Boolean @default(false) @map("page_valid_flag")
|
|
4
|
+
yearEnd1 String @map("year_end_1")
|
|
5
|
+
rentalIncome1 Decimal @map("rental_income_1")
|
|
6
|
+
netProfit1 Decimal @map("net_profit_1")
|
|
7
|
+
yearEnd2 String @map("year_end_2")
|
|
8
|
+
rentalIncome2 Decimal @map("rental_income_2")
|
|
9
|
+
netProfit2 Decimal @map("net_profit_2")
|
|
10
|
+
yearEnd3 String @map("year_end_3")
|
|
11
|
+
rentalIncome3 Decimal @map("rental_income_3")
|
|
12
|
+
netProfit3 Decimal @map("net_profit_3")
|
|
13
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
14
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
// Relations
|
|
17
|
+
applicants Applicant[] @relation("ApplicantPropertyIncome")
|
|
18
|
+
|
|
19
|
+
@@map("applicant_property_income")
|
|
17
20
|
}
|
|
@@ -3,20 +3,20 @@ model ResidenceCommitment {
|
|
|
3
3
|
applicantId String @map("applicant_id")
|
|
4
4
|
pageValidFlag Boolean @default(false)
|
|
5
5
|
financeTypeHppLid String? @map("finance_type_hpp_lid")
|
|
6
|
-
lenderName String
|
|
7
|
-
propertyValue Decimal
|
|
6
|
+
lenderName String @map("lender_name")
|
|
7
|
+
propertyValue Decimal @map("property_value")
|
|
8
8
|
hppRepaymentTypeLid String @map("hpp_repayment_type_lid")
|
|
9
9
|
mortgageTypeLid String? @map("mortgage_type_lid")
|
|
10
10
|
fixedTerm String
|
|
11
|
-
commitmentId String
|
|
11
|
+
commitmentId String @map("commitment_id")
|
|
12
12
|
originalLoanAmount Decimal
|
|
13
|
-
outstandingBalance Decimal
|
|
13
|
+
outstandingBalance Decimal @map("outstanding_balance")
|
|
14
14
|
startDate String
|
|
15
15
|
mortgageRate Float
|
|
16
16
|
remainingTermMonth Int
|
|
17
17
|
financeHomeTypeLid String @map("finance_home_type_lid")
|
|
18
18
|
chargeTypeLid String @map("charge_type_lid")
|
|
19
|
-
monthlyPayment Decimal
|
|
19
|
+
monthlyPayment Decimal @map("monthly_payment")
|
|
20
20
|
furtherAdvances Boolean
|
|
21
21
|
furtherAdvanceDetails String
|
|
22
22
|
accountUptoDate Boolean
|
|
@@ -25,11 +25,12 @@ model ResidenceCommitment {
|
|
|
25
25
|
accountInArrearsDetails String
|
|
26
26
|
doHaveSharedResponsibility Boolean
|
|
27
27
|
sharedMortgage String
|
|
28
|
+
jointNames Boolean @map("joint_names")
|
|
28
29
|
createdAt DateTime @default(now()) @map("created_at")
|
|
29
30
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
30
31
|
|
|
31
32
|
// Relations
|
|
32
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
33
|
+
applicant Applicant @relation("ApplicantResidenceCommitments", fields: [applicantId], references: [id])
|
|
33
34
|
financeTypeHpp Lookup? @relation("FinanceTypeHpp", fields: [financeTypeHppLid], references: [id])
|
|
34
35
|
hppRepaymentType Lookup @relation("HppRepaymentType", fields: [hppRepaymentTypeLid], references: [id])
|
|
35
36
|
mortgageType Lookup? @relation("MortgageType", fields: [mortgageTypeLid], references: [id])
|
|
@@ -15,7 +15,7 @@ model SecuredLoanCommitment {
|
|
|
15
15
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
16
16
|
|
|
17
17
|
// Relations
|
|
18
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
18
|
+
applicant Applicant @relation("ApplicantSecuredLoanCommitments", fields: [applicantId], references: [id])
|
|
19
19
|
|
|
20
20
|
@@map("applicant_secured_loan_commitments")
|
|
21
21
|
}
|
|
@@ -14,7 +14,7 @@ model UnsecuredLoanCommitment {
|
|
|
14
14
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
15
15
|
|
|
16
16
|
// Relations
|
|
17
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
17
|
+
applicant Applicant @relation("ApplicantUnsecuredLoanCommitments", fields: [applicantId], references: [id])
|
|
18
18
|
|
|
19
19
|
@@map("applicant_unsecured_loan_commitments")
|
|
20
20
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
model ApplicationCompany {
|
|
2
|
-
id
|
|
3
|
-
applicationId
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
applicationId String @unique @map("application_id")
|
|
4
4
|
name String
|
|
5
5
|
registrationNumber String? @map("registration_number")
|
|
6
|
-
createdAt
|
|
7
|
-
updatedAt
|
|
8
|
-
|
|
6
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
7
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
8
|
+
|
|
9
|
+
// Relations
|
|
10
|
+
application Application @relation("ApplicationCompany", fields: [applicationId], references: [id])
|
|
9
11
|
|
|
10
12
|
@@map("application_companies")
|
|
11
13
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
model ApplicationDirectDebit {
|
|
2
|
-
id
|
|
3
|
-
applicationId
|
|
2
|
+
id String @id @default(uuid())
|
|
3
|
+
applicationId String @unique @map("application_id")
|
|
4
4
|
accountNumber String @map("account_number")
|
|
5
5
|
sortCode String @map("sort_code")
|
|
6
|
-
createdAt
|
|
7
|
-
updatedAt
|
|
8
|
-
|
|
6
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
7
|
+
updatedAt DateTime @updatedAt @map("updated_at")
|
|
8
|
+
|
|
9
|
+
// Relations
|
|
10
|
+
application Application @relation("ApplicationDirectDebit", fields: [applicationId], references: [id])
|
|
9
11
|
|
|
10
12
|
@@map("application_direct_debits")
|
|
11
13
|
}
|
|
@@ -35,7 +35,7 @@ model ApplicationMortgage {
|
|
|
35
35
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
36
36
|
|
|
37
37
|
// Relations
|
|
38
|
-
application Application @relation
|
|
38
|
+
application Application @relation("ApplicationMortgage", fields: [applicationId], references: [id])
|
|
39
39
|
repaymentType Lookup @relation("RepaymentType", fields: [repaymentTypeLid], references: [id])
|
|
40
40
|
exitStrategy Lookup @relation("ExitStrategy", fields: [exitStrategyLid], references: [id])
|
|
41
41
|
sourceOfFunds Lookup @relation("SourceOfFunds", fields: [sourceOfFundsLid], references: [id])
|
|
@@ -21,7 +21,7 @@ model ApplicationProduct {
|
|
|
21
21
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
22
22
|
|
|
23
23
|
// Relations
|
|
24
|
-
application Application @relation(fields: [applicationId], references: [id])
|
|
24
|
+
application Application @relation("ApplicationProducts", fields: [applicationId], references: [id])
|
|
25
25
|
lendingType Lookup? @relation("LendingType", fields: [lendingTypeLid], references: [id])
|
|
26
26
|
repaymentType Lookup? @relation("RepaymentType", fields: [repaymentTypeLid], references: [id])
|
|
27
27
|
isFinanceRecommendedToApplicant Lookup? @relation("FinanceRecommended", fields: [isFinanceRecommendedToApplicantLid], references: [id])
|
|
@@ -37,7 +37,7 @@ model ApplicationRationale {
|
|
|
37
37
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
38
38
|
|
|
39
39
|
// Relations
|
|
40
|
-
application Application @relation
|
|
40
|
+
application Application @relation("ApplicationRationale", fields: [applicationId], references: [id])
|
|
41
41
|
affordabilityStatus Lookup? @relation("AffordabilityStatus", fields: [affordabilityStatusLid], references: [id])
|
|
42
42
|
applicantsStatus Lookup? @relation("ApplicantsStatus", fields: [applicantsStatusLid], references: [id])
|
|
43
43
|
creditConductStatus Lookup? @relation("CreditConductStatus", fields: [creditConductStatusLid], references: [id])
|
|
@@ -2,7 +2,7 @@ model Application {
|
|
|
2
2
|
id String @id @default(uuid())
|
|
3
3
|
queueId String[] @map("queue_id")
|
|
4
4
|
assignedToUserId String? @map("assigned_to_user_id")
|
|
5
|
-
applicationId String @map("application_id")
|
|
5
|
+
applicationId String @unique @map("application_id")
|
|
6
6
|
isApplicationFeePaid String @map("is_application_fee_paid")
|
|
7
7
|
applicationNumber String @map("application_number")
|
|
8
8
|
applicationTypeLid String @map("application_type_lid")
|
|
@@ -54,25 +54,41 @@ model Application {
|
|
|
54
54
|
propertyIds String[] @map("property_ids")
|
|
55
55
|
createdAt DateTime @default(now()) @map("created_at")
|
|
56
56
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
57
|
+
pageValidFlag Boolean @default(false)
|
|
58
|
+
applicationStatusLid String @map("application_status_lid")
|
|
59
|
+
applicationSubTypeLid String @map("application_sub_type_lid")
|
|
60
|
+
applicationSubTypeOther String? @map("application_sub_type_other")
|
|
61
|
+
applicationSubTypeOtherDetails String? @map("application_sub_type_other_details")
|
|
62
|
+
applicationSubTypeOtherLid String? @map("application_sub_type_other_lid")
|
|
63
|
+
applicationSubTypeOtherLidDetails String? @map("application_sub_type_other_lid_details")
|
|
64
|
+
applicationSubTypeOtherLidOther String? @map("application_sub_type_other_lid_other")
|
|
65
|
+
applicationSubTypeOtherLidOtherDetails String? @map("application_sub_type_other_lid_other_details")
|
|
57
66
|
|
|
58
67
|
// Relations
|
|
59
|
-
broker
|
|
60
|
-
security
|
|
61
|
-
solicitor
|
|
62
|
-
product
|
|
63
|
-
directDebit
|
|
64
|
-
mortgage
|
|
65
|
-
company
|
|
66
|
-
rationale
|
|
67
|
-
applicants
|
|
68
|
-
properties
|
|
68
|
+
broker Broker @relation("BrokerApplications", fields: [brokerId], references: [id])
|
|
69
|
+
security Security?
|
|
70
|
+
solicitor Solicitor?
|
|
71
|
+
product Product? @relation(fields: [productId], references: [id])
|
|
72
|
+
directDebit ApplicationDirectDebit? @relation("ApplicationDirectDebit")
|
|
73
|
+
mortgage ApplicationMortgage? @relation("ApplicationMortgage")
|
|
74
|
+
company ApplicationCompany? @relation("ApplicationCompany")
|
|
75
|
+
rationale ApplicationRationale? @relation("ApplicationRationale")
|
|
76
|
+
applicants Applicant[]
|
|
77
|
+
properties Property[] @relation("ApplicationProperties")
|
|
78
|
+
documents ApplicationDocument[]
|
|
79
|
+
notes ApplicationNote[]
|
|
80
|
+
audits ApplicationAudit[]
|
|
81
|
+
underwriters Underwriter[] @relation("ApplicationUnderwriters")
|
|
82
|
+
status Lookup @relation("Status", fields: [statusLid], references: [id])
|
|
83
|
+
directDebits DirectDebit[] @relation("ApplicationDirectDebits")
|
|
84
|
+
products ApplicationProduct[] @relation("ApplicationProducts")
|
|
85
|
+
companies Company[] @relation("ApplicationCompany")
|
|
69
86
|
|
|
70
87
|
// Lookup relations
|
|
71
88
|
applicationType Lookup @relation("ApplicationType", fields: [applicationTypeLid], references: [id])
|
|
72
89
|
lendingType Lookup @relation("LendingType", fields: [lendingTypeLid], references: [id])
|
|
73
90
|
purchaseType Lookup @relation("PurchaseType", fields: [purchaseTypeLid], references: [id])
|
|
74
91
|
repaymentType Lookup @relation("RepaymentType", fields: [repaymentTypeLid], references: [id])
|
|
75
|
-
status Lookup @relation("Status", fields: [statusLid], references: [id])
|
|
76
92
|
|
|
77
93
|
@@map("applications")
|
|
78
94
|
@@index([applicationTypeLid])
|
|
@@ -18,6 +18,10 @@ model Broker {
|
|
|
18
18
|
lastName String? @map("last_name")
|
|
19
19
|
createdAt DateTime @default(now()) @map("created_at")
|
|
20
20
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
21
|
+
|
|
22
|
+
// Relations
|
|
23
|
+
applications Application[] @relation("BrokerApplications")
|
|
24
|
+
|
|
21
25
|
|
|
22
26
|
@@map("brokers")
|
|
23
27
|
}
|
|
@@ -47,12 +47,12 @@ model Company {
|
|
|
47
47
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
48
48
|
|
|
49
49
|
// Relations
|
|
50
|
-
application
|
|
51
|
-
businessType
|
|
52
|
-
taxJurisdiction
|
|
53
|
-
addressCountry
|
|
54
|
-
applicationType
|
|
55
|
-
applicantShareholdings
|
|
50
|
+
application Application @relation("ApplicationCompany", fields: [applicationId], references: [id])
|
|
51
|
+
businessType Lookup @relation("BusinessType", fields: [businessTypeLid], references: [id])
|
|
52
|
+
taxJurisdiction Lookup @relation("TaxJurisdiction", fields: [taxJurisdictionLid], references: [id])
|
|
53
|
+
addressCountry Lookup @relation("AddressCountry", fields: [addressCountryLid], references: [id])
|
|
54
|
+
applicationType Lookup @relation("ApplicationType", fields: [applicationTypeLid], references: [id])
|
|
55
|
+
applicantShareholdings ApplicantShareholding[]
|
|
56
56
|
|
|
57
57
|
@@map("companies")
|
|
58
58
|
}
|
|
@@ -69,7 +69,7 @@ model ApplicantShareholding {
|
|
|
69
69
|
|
|
70
70
|
// Relations
|
|
71
71
|
company Company @relation(fields: [companyId], references: [id])
|
|
72
|
-
applicant Applicant @relation(fields: [applicantId], references: [id])
|
|
72
|
+
applicant Applicant @relation("ApplicantShareholdings", fields: [applicantId], references: [id])
|
|
73
73
|
directorShareholder Lookup? @relation("DirectorShareholder", fields: [directorShareholderLid], references: [id])
|
|
74
74
|
|
|
75
75
|
@@map("applicant_shareholdings")
|