@dynamatix/gb-schemas 2.0.55 → 2.0.57

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.
@@ -1,54 +1,104 @@
1
+ export declare class FeeEntity {
2
+ id: string;
3
+ applicationProductFeatureId: string;
4
+ feeType: string;
5
+ description: string;
6
+ feeAmount: number;
7
+ rate: number;
8
+ addedToLoan: boolean;
9
+ allowOverride: boolean;
10
+ additionalData?: any;
11
+ constructor(partial: Partial<FeeEntity>);
12
+ }
13
+ export declare class CashflowPeriodEntity {
14
+ id: string;
15
+ applicationProductFeatureId: string;
16
+ type: string;
17
+ from?: number;
18
+ to?: number;
19
+ instalmentAmount?: number;
20
+ instalmentInterest?: number;
21
+ instalmentCapitalRepaid?: number;
22
+ otherCosts?: number;
23
+ outstandingCapital?: number;
24
+ constructor(partial: Partial<CashflowPeriodEntity>);
25
+ }
26
+ export declare class CalculationsEntity {
27
+ id: string;
28
+ applicationProductFeatureId: string;
29
+ ltv?: number;
30
+ rentalCoverageRatioRate?: number;
31
+ bankContributionRate?: number;
32
+ bankInitialShareRate?: number;
33
+ totalAmountPayable?: number;
34
+ fixedMonthlyPayment?: number;
35
+ fixedMonthlyCapital?: number;
36
+ fixedMonthlyInterest?: number;
37
+ variableMonthlyPayment?: number;
38
+ summaryTotal?: number;
39
+ reimbursementPerPound?: number;
40
+ stressedPayment?: number;
41
+ stressedPaymentRate?: number;
42
+ rentalCoverage?: number;
43
+ rentalCoverageWithoutTopUp?: number;
44
+ constructor(partial: Partial<CalculationsEntity>);
45
+ }
1
46
  export declare class ProductFeaturesEntity {
2
47
  id: string;
48
+ applicationId: string;
3
49
  name: string;
4
- clientAdvance: string;
5
- ltv: string;
6
- repayment: string;
7
- variableRepayment: string;
8
- reversionRateWithoutBaseRate?: string;
9
- totalReversionRate?: string;
10
- initialRate: string;
11
- fixedTerm: string;
50
+ clientAdvance: number;
51
+ ltv: number;
52
+ repayment: number;
53
+ variableRepayment: number;
54
+ reversionRateWithoutBaseRate?: number;
55
+ totalReversionRate?: number;
56
+ initialRate: number;
57
+ fixedTerm: number;
12
58
  fixedTermEndDate?: string;
13
- baseRate?: string;
14
- productRate?: string;
15
- apr?: string;
16
- rentalCoverage?: string;
59
+ baseRate?: number;
60
+ productRate?: number;
61
+ apr?: number;
62
+ rentalCoverage?: number;
17
63
  repaymentType?: string;
18
64
  applicationCategory?: string;
19
65
  securityType?: string;
20
66
  erc?: string;
21
67
  loanType?: string;
22
68
  maxLtvLimit?: string;
23
- reimbursement?: string;
24
- reimbursementPerPound?: string;
25
- stressedApr?: string;
26
- stressedRate?: string;
27
- stressedRepayment?: string;
69
+ reimbursement?: number;
70
+ reimbursementPerPound?: number;
71
+ stressedApr?: number;
72
+ stressedRate?: number;
73
+ stressedRepayment?: number;
28
74
  liborFloorRate?: string;
29
- totalTermInMonths?: string;
75
+ totalTermInMonths?: number;
30
76
  chargeType: string;
31
77
  productCategory: string;
32
78
  ercCode: string;
33
- variableTerm?: string;
34
- totalFeePayable?: string;
79
+ variableTerm?: number;
80
+ totalFeePayable?: number;
35
81
  dipIssueDate?: string;
36
82
  estimatedCompletionDate?: string;
37
83
  dipExpiryDate?: string;
38
84
  fixedRepaymentUntillDate?: string;
39
85
  rentalReviewDate?: string;
40
- totalReimbursementWithFee?: string;
41
- finalRentPayment?: string;
42
- clientDeposit?: string;
43
- firstRentPayment?: string;
86
+ totalReimbursementWithFee?: number;
87
+ finalRentPayment?: number;
88
+ clientDeposit?: number;
89
+ firstRentPayment?: number;
44
90
  ercFeatures?: any;
45
91
  icr?: string;
46
92
  ufssProductCode?: string;
47
93
  ufssInterestRateCode?: string;
48
- stressedPayment?: string;
49
- stressedPaymentRate?: string;
94
+ stressedPayment?: number;
95
+ stressedPaymentRate?: number;
50
96
  createdAt: Date;
51
97
  updatedAt: Date;
98
+ cashflowPeriodsTotalNoOfPayments?: number;
99
+ fees: FeeEntity[];
100
+ cashflowPeriods: CashflowPeriodEntity[];
101
+ calculations?: CalculationsEntity;
52
102
  constructor(partial: Partial<ProductFeaturesEntity>);
53
103
  }
54
104
  //# sourceMappingURL=product-features.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-features.entity.d.ts","sourceRoot":"","sources":["../../../entities/applications/product-features.entity.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAqB;IAC9B,EAAE,EAAG,MAAM,CAAC;IACZ,IAAI,EAAG,MAAM,CAAC;IACd,aAAa,EAAG,MAAM,CAAC;IACvB,GAAG,EAAG,MAAM,CAAC;IACb,SAAS,EAAG,MAAM,CAAC;IACnB,iBAAiB,EAAG,MAAM,CAAC;IAC3B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAG,MAAM,CAAC;IACrB,SAAS,EAAG,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAG,MAAM,CAAC;IACpB,eAAe,EAAG,MAAM,CAAC;IACzB,OAAO,EAAG,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAG,IAAI,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;gBAEL,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC;CAGtD"}
1
+ {"version":3,"file":"product-features.entity.d.ts","sourceRoot":"","sources":["../../../entities/applications/product-features.entity.ts"],"names":[],"mappings":"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"}
@@ -1,3 +1,18 @@
1
+ export class FeeEntity {
2
+ constructor(partial) {
3
+ Object.assign(this, partial);
4
+ }
5
+ }
6
+ export class CashflowPeriodEntity {
7
+ constructor(partial) {
8
+ Object.assign(this, partial);
9
+ }
10
+ }
11
+ export class CalculationsEntity {
12
+ constructor(partial) {
13
+ Object.assign(this, partial);
14
+ }
15
+ }
1
16
  export class ProductFeaturesEntity {
2
17
  constructor(partial) {
3
18
  Object.assign(this, partial);
@@ -1,56 +1,118 @@
1
+ export class FeeEntity {
2
+ id!: string;
3
+ applicationProductFeatureId!: string;
4
+ feeType!: string;
5
+ description!: string;
6
+ feeAmount!: number;
7
+ rate!: number;
8
+ addedToLoan!: boolean;
9
+ allowOverride!: boolean;
10
+ additionalData?: any;
11
+
12
+ constructor(partial: Partial<FeeEntity>) {
13
+ Object.assign(this, partial);
14
+ }
15
+ }
16
+
17
+ export class CashflowPeriodEntity {
18
+ id!: string;
19
+ applicationProductFeatureId!: string;
20
+ type!: string;
21
+ from?: number;
22
+ to?: number;
23
+ instalmentAmount?: number;
24
+ instalmentInterest?: number;
25
+ instalmentCapitalRepaid?: number;
26
+ otherCosts?: number;
27
+ outstandingCapital?: number;
28
+
29
+ constructor(partial: Partial<CashflowPeriodEntity>) {
30
+ Object.assign(this, partial);
31
+ }
32
+ }
33
+
34
+ export class CalculationsEntity {
35
+ id!: string;
36
+ applicationProductFeatureId!: string;
37
+ ltv?: number;
38
+ rentalCoverageRatioRate?: number;
39
+ bankContributionRate?: number;
40
+ bankInitialShareRate?: number;
41
+ totalAmountPayable?: number;
42
+ fixedMonthlyPayment?: number;
43
+ fixedMonthlyCapital?: number;
44
+ fixedMonthlyInterest?: number;
45
+ variableMonthlyPayment?: number;
46
+ summaryTotal?: number;
47
+ reimbursementPerPound?: number;
48
+ stressedPayment?: number;
49
+ stressedPaymentRate?: number;
50
+ rentalCoverage?: number;
51
+ rentalCoverageWithoutTopUp?: number;
52
+
53
+ constructor(partial: Partial<CalculationsEntity>) {
54
+ Object.assign(this, partial);
55
+ }
56
+ }
57
+
1
58
  export class ProductFeaturesEntity {
2
- id!: string;
3
- name!: string;
4
- clientAdvance!: string;
5
- ltv!: string;
6
- repayment!: string;
7
- variableRepayment!: string;
8
- reversionRateWithoutBaseRate?: string;
9
- totalReversionRate?: string;
10
- initialRate!: string;
11
- fixedTerm!: string;
12
- fixedTermEndDate?: string;
13
- baseRate?: string;
14
- productRate?: string;
15
- apr?: string;
16
- rentalCoverage?: string;
17
- repaymentType?: string;
18
- applicationCategory?: string;
19
- securityType?: string;
20
- erc?: string;
21
- loanType?: string;
22
- maxLtvLimit?: string;
23
- reimbursement?: string;
24
- reimbursementPerPound?: string;
25
- stressedApr?: string;
26
- stressedRate?: string;
27
- stressedRepayment?: string;
28
- liborFloorRate?: string;
29
- totalTermInMonths?: string;
30
- chargeType!: string;
31
- productCategory!: string;
32
- ercCode!: string;
33
- variableTerm?: string;
34
- totalFeePayable?: string;
35
- dipIssueDate?: string;
36
- estimatedCompletionDate?: string;
37
- dipExpiryDate?: string;
38
- fixedRepaymentUntillDate?: string;
39
- rentalReviewDate?: string;
40
- totalReimbursementWithFee?: string;
41
- finalRentPayment?: string;
42
- clientDeposit?: string;
43
- firstRentPayment?: string;
44
- ercFeatures?: any;
45
- icr?: string;
46
- ufssProductCode?: string;
47
- ufssInterestRateCode?: string;
48
- stressedPayment?: string;
49
- stressedPaymentRate?: string;
50
- createdAt!: Date;
51
- updatedAt!: Date;
59
+ id!: string;
60
+ applicationId!: string;
61
+ name!: string;
62
+ clientAdvance!: number;
63
+ ltv!: number;
64
+ repayment!: number;
65
+ variableRepayment!: number;
66
+ reversionRateWithoutBaseRate?: number;
67
+ totalReversionRate?: number;
68
+ initialRate!: number;
69
+ fixedTerm!: number;
70
+ fixedTermEndDate?: string;
71
+ baseRate?: number;
72
+ productRate?: number;
73
+ apr?: number;
74
+ rentalCoverage?: number;
75
+ repaymentType?: string;
76
+ applicationCategory?: string;
77
+ securityType?: string;
78
+ erc?: string;
79
+ loanType?: string;
80
+ maxLtvLimit?: string;
81
+ reimbursement?: number;
82
+ reimbursementPerPound?: number;
83
+ stressedApr?: number;
84
+ stressedRate?: number;
85
+ stressedRepayment?: number;
86
+ liborFloorRate?: string;
87
+ totalTermInMonths?: number;
88
+ chargeType!: string;
89
+ productCategory!: string;
90
+ ercCode!: string;
91
+ variableTerm?: number;
92
+ totalFeePayable?: number;
93
+ dipIssueDate?: string;
94
+ estimatedCompletionDate?: string;
95
+ dipExpiryDate?: string;
96
+ fixedRepaymentUntillDate?: string;
97
+ rentalReviewDate?: string;
98
+ totalReimbursementWithFee?: number;
99
+ finalRentPayment?: number;
100
+ clientDeposit?: number;
101
+ firstRentPayment?: number;
102
+ ercFeatures?: any;
103
+ icr?: string;
104
+ ufssProductCode?: string;
105
+ ufssInterestRateCode?: string;
106
+ stressedPayment?: number;
107
+ stressedPaymentRate?: number;
108
+ createdAt!: Date;
109
+ updatedAt!: Date;
110
+ cashflowPeriodsTotalNoOfPayments?: number;
111
+ fees!: FeeEntity[];
112
+ cashflowPeriods!: CashflowPeriodEntity[];
113
+ calculations?: CalculationsEntity;
52
114
 
53
- constructor(partial: Partial<ProductFeaturesEntity>) {
54
- Object.assign(this, partial);
55
- }
56
- }
115
+ constructor(partial: Partial<ProductFeaturesEntity>) {
116
+ Object.assign(this, partial);
117
+ }
118
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.0.55",
3
+ "version": "2.0.57",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -54,24 +54,25 @@ model Application {
54
54
  applicantIds String[] @map("applicant_ids")
55
55
  propertyIds String[] @map("property_ids")
56
56
  createdAt DateTime @default(now()) @map("created_at")
57
- updatedAt DateTime @updatedAt @default(now()) @map("updated_at")
57
+ updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
58
58
 
59
59
  // Relations
60
- broker Broker? @relation("ApplicationBroker", fields: [brokerId], references: [id])
61
- security Security? @relation("ApplicationSecurity")
62
- solicitor Solicitor? @relation("ApplicationSolicitor")
63
- product Product? @relation("ApplicationProduct", fields: [productId], references: [id])
64
- directDebit ApplicationDirectDebit? @relation("ApplicationDirectDebit")
65
- creditProfile ApplicationCreditProfile? @relation("ApplicationCreditProfile")
66
- mortgage ApplicationMortgage? @relation("ApplicationMortgage")
67
- company ApplicationCompany? @relation("ApplicationCompany")
68
- rationale ApplicationRationale? @relation("ApplicationRationale")
69
- applicants Applicant[] @relation("ApplicationApplicants")
70
- properties Property[] @relation("ApplicationProperties")
71
- documents ApplicationDocument[]
72
- notes ApplicationNote[]
73
- audits ApplicationAudit[]
74
- products ApplicationProduct[] @relation("ApplicationProducts")
60
+ broker Broker? @relation("ApplicationBroker", fields: [brokerId], references: [id])
61
+ security Security? @relation("ApplicationSecurity")
62
+ solicitor Solicitor? @relation("ApplicationSolicitor")
63
+ product Product? @relation("ApplicationProduct", fields: [productId], references: [id])
64
+ directDebit ApplicationDirectDebit? @relation("ApplicationDirectDebit")
65
+ creditProfile ApplicationCreditProfile? @relation("ApplicationCreditProfile")
66
+ mortgage ApplicationMortgage? @relation("ApplicationMortgage")
67
+ company ApplicationCompany? @relation("ApplicationCompany")
68
+ rationale ApplicationRationale? @relation("ApplicationRationale")
69
+ productFeatures ProductFeatures? @relation("ApplicationProductFeature")
70
+ applicants Applicant[] @relation("ApplicationApplicants")
71
+ properties Property[] @relation("ApplicationProperties")
72
+ documents ApplicationDocument[]
73
+ notes ApplicationNote[]
74
+ audits ApplicationAudit[]
75
+ products ApplicationProduct[] @relation("ApplicationProducts")
75
76
 
76
77
  // Lookup relations
77
78
  applicationType Lookup @relation("ApplicationType", fields: [applicationTypeLid], references: [id])
@@ -1,54 +1,122 @@
1
1
  model ProductFeatures {
2
- id String @id @default(uuid())
3
- name String @map("name")
4
- clientAdvance String @map("client_advance")
5
- ltv String @map("ltv")
6
- repayment String @map("repayment")
7
- variableRepayment String @map("variable_repayment")
8
- reversionRateWithoutBaseRate String? @map("reversion_rate_without_base_rate")
9
- totalReversionRate String? @map("total_reversion_rate")
10
- initialRate String @map("initial_rate")
11
- fixedTerm String @map("fixed_term")
12
- fixedTermEndDate String? @map("fixed_term_end_date")
13
- baseRate String? @map("base_rate")
14
- productRate String? @map("product_rate")
15
- apr String? @map("apr")
16
- rentalCoverage String? @map("rental_coverage")
17
- repaymentType String? @map("repayment_type")
18
- applicationCategory String? @map("application_category")
19
- securityType String? @map("security_type")
20
- erc String? @map("erc")
21
- loanType String? @map("loan_type")
22
- maxLtvLimit String? @map("max_ltv_limit")
23
- reimbursement String? @map("reimbursement")
24
- reimbursementPerPound String? @map("reimbursement_per_pound")
25
- stressedApr String? @map("stressed_apr")
26
- stressedRate String? @map("stressed_rate")
27
- stressedRepayment String? @map("stressed_repayment")
28
- liborFloorRate String? @map("libor_floor_rate")
29
- totalTermInMonths String? @map("total_term_in_months")
30
- chargeType String @default("") @map("charge_type")
31
- productCategory String @default("") @map("product_category")
32
- ercCode String @default("") @map("erc_code")
33
- variableTerm String? @map("variable_term")
34
- totalFeePayable String? @map("total_fee_payable")
35
- dipIssueDate String? @map("dip_issue_date")
36
- estimatedCompletionDate String? @map("estimated_completion_date")
37
- dipExpiryDate String? @map("dip_expiry_date")
38
- fixedRepaymentUntillDate String? @map("fixed_repayment_untill_date")
39
- rentalReviewDate String? @map("rental_review_date")
40
- totalReimbursementWithFee String? @map("total_reimbursement_with_fee")
41
- finalRentPayment String? @map("final_rent_payment")
42
- clientDeposit String? @map("client_deposit")
43
- firstRentPayment String? @map("first_rent_payment")
44
- ercFeatures Json? @map("erc_features")
45
- icr String? @map("icr")
46
- ufssProductCode String? @map("ufss_product_code")
47
- ufssInterestRateCode String? @map("ufss_interest_rate_code")
48
- stressedPayment String? @map("stressed_payment")
49
- stressedPaymentRate String? @map("stressed_payment_rate")
50
- createdAt DateTime @default(now()) @map("created_at")
51
- updatedAt DateTime @updatedAt @map("updated_at")
2
+ id String @id @default(uuid())
3
+ applicationId String @unique @map("application_id")
4
+ name String @map("name")
5
+ clientAdvance Int @map("client_advance")
6
+ ltv Decimal @map("ltv") @db.Decimal(10, 2)
7
+ repayment Decimal @map("repayment") @db.Decimal(10, 2)
8
+ variableRepayment Decimal @map("variable_repayment") @db.Decimal(10, 2)
9
+ reversionRateWithoutBaseRate Decimal? @map("reversion_rate_without_base_rate") @db.Decimal(10, 2)
10
+ totalReversionRate Decimal? @map("total_reversion_rate") @db.Decimal(10, 2)
11
+ initialRate Decimal @map("initial_rate") @db.Decimal(10, 2)
12
+ fixedTerm Int @map("fixed_term")
13
+ fixedTermEndDate String? @map("fixed_term_end_date")
14
+ baseRate Decimal? @map("base_rate") @db.Decimal(10, 2)
15
+ productRate Decimal? @map("product_rate") @db.Decimal(10, 2)
16
+ apr Decimal? @map("apr") @db.Decimal(10, 2)
17
+ rentalCoverage Decimal? @map("rental_coverage") @db.Decimal(10, 2)
18
+ repaymentType String? @map("repayment_type")
19
+ applicationCategory String? @map("application_category")
20
+ securityType String? @map("security_type")
21
+ erc String? @map("erc")
22
+ loanType String? @map("loan_type")
23
+ maxLtvLimit String? @map("max_ltv_limit")
24
+ reimbursement Decimal? @map("reimbursement") @db.Decimal(10, 2)
25
+ reimbursementPerPound Decimal? @map("reimbursement_per_pound") @db.Decimal(10, 2)
26
+ stressedApr Decimal? @map("stressed_apr") @db.Decimal(10, 2)
27
+ stressedRate Decimal? @map("stressed_rate") @db.Decimal(10, 2)
28
+ stressedRepayment Decimal? @map("stressed_repayment") @db.Decimal(10, 2)
29
+ liborFloorRate String? @map("libor_floor_rate")
30
+ totalTermInMonths Int? @map("total_term_in_months")
31
+ chargeType String @default("") @map("charge_type")
32
+ productCategory String @default("") @map("product_category")
33
+ ercCode String @default("") @map("erc_code")
34
+ variableTerm Int? @map("variable_term")
35
+ totalFeePayable Int? @map("total_fee_payable")
36
+ dipIssueDate String? @map("dip_issue_date")
37
+ estimatedCompletionDate String? @map("estimated_completion_date")
38
+ dipExpiryDate String? @map("dip_expiry_date")
39
+ fixedRepaymentUntillDate String? @map("fixed_repayment_untill_date")
40
+ rentalReviewDate String? @map("rental_review_date")
41
+ totalReimbursementWithFee Decimal? @map("total_reimbursement_with_fee") @db.Decimal(10, 2)
42
+ finalRentPayment Int? @map("final_rent_payment")
43
+ clientDeposit Int? @map("client_deposit")
44
+ firstRentPayment Decimal? @map("first_rent_payment") @db.Decimal(10, 2)
45
+ ercFeatures Json? @map("erc_features")
46
+ icr String? @map("icr")
47
+ ufssProductCode String? @map("ufss_product_code")
48
+ ufssInterestRateCode String? @map("ufss_interest_rate_code")
49
+ stressedPayment Decimal? @map("stressed_payment") @db.Decimal(10, 2)
50
+ stressedPaymentRate Decimal? @map("stressed_payment_rate") @db.Decimal(10, 2)
51
+ createdAt DateTime @default(now()) @map("created_at")
52
+ updatedAt DateTime @updatedAt @map("updated_at")
53
+ cashflowPeriodsTotalNoOfPayments Int? @map("cashflow_periods_total_no_of_payments")
54
+ fees Fee[]
55
+ cashflowPeriods CashflowPeriod[]
56
+ calculations Calculations?
57
+
58
+ // Relationships
59
+ application Application @relation("ApplicationProductFeature", fields: [applicationId], references: [id])
52
60
 
53
61
  @@map("product_features")
54
62
  }
63
+
64
+ model Fee {
65
+ id String @id @default(uuid())
66
+ applicationProductFeatureId String @map("application_product_feature_id")
67
+ feeType String @map("fee_type")
68
+ description String @map("description")
69
+ feeAmount Int @map("fee_amount")
70
+ rate Decimal @map("rate") @db.Decimal(10, 2)
71
+ addedToLoan Boolean @default(false) @map("added_to_loan")
72
+ allowOverride Boolean @default(false) @map("allow_override")
73
+ additionalData Json? @map("additional_data")
74
+
75
+ // Relations
76
+ applicationProductFeature ProductFeatures @relation(fields: [applicationProductFeatureId], references: [id])
77
+
78
+ @@map("fees")
79
+ }
80
+
81
+ model CashflowPeriod {
82
+ id String @id @default(uuid())
83
+ applicationProductFeatureId String @map("application_product_feature_id")
84
+ type String @map("type")
85
+ from Int? @map("from")
86
+ to Int? @map("to")
87
+ instalmentAmount Decimal? @map("instalment_amount") @db.Decimal(10, 2)
88
+ instalmentInterest Decimal? @map("instalment_interest") @db.Decimal(10, 2)
89
+ instalmentCapitalRepaid Decimal? @map("instalment_capital_repaid") @db.Decimal(10, 2)
90
+ otherCosts Decimal? @map("other_costs") @db.Decimal(10, 2)
91
+ outstandingCapital Decimal? @map("outstanding_capital") @db.Decimal(10, 2)
92
+
93
+ // Relations
94
+ applicationProductFeature ProductFeatures @relation(fields: [applicationProductFeatureId], references: [id])
95
+
96
+ @@map("cashflow_periods")
97
+ }
98
+
99
+ model Calculations {
100
+ id String @id @default(uuid())
101
+ applicationProductFeatureId String @unique @map("application_product_feature_id")
102
+ ltv Decimal? @map("ltv") @db.Decimal(10, 2)
103
+ rentalCoverageRatioRate Decimal? @map("rental_coverage_ratio_rate") @db.Decimal(10, 2)
104
+ bankContributionRate Decimal? @map("bank_contribution_rate") @db.Decimal(10, 2)
105
+ bankInitialShareRate Decimal? @map("bank_initial_share_rate") @db.Decimal(10, 2)
106
+ totalAmountPayable Decimal? @map("total_amount_payable") @db.Decimal(10, 2)
107
+ fixedMonthlyPayment Decimal? @map("fixed_monthly_payment") @db.Decimal(10, 2)
108
+ fixedMonthlyCapital Decimal? @map("fixed_monthly_capital") @db.Decimal(10, 2)
109
+ fixedMonthlyInterest Decimal? @map("fixed_monthly_interest") @db.Decimal(10, 2)
110
+ variableMonthlyPayment Decimal? @map("variable_monthly_payment") @db.Decimal(10, 2)
111
+ summaryTotal Decimal? @map("summary_total") @db.Decimal(10, 2)
112
+ reimbursementPerPound Decimal? @map("reimbursement_per_pound") @db.Decimal(10, 2)
113
+ stressedPayment Decimal? @map("stressed_payment") @db.Decimal(10, 2)
114
+ stressedPaymentRate Decimal? @map("stressed_payment_rate") @db.Decimal(10, 2)
115
+ rentalCoverage Decimal? @map("rental_coverage") @db.Decimal(10, 2)
116
+ rentalCoverageWithoutTopUp Decimal? @map("rental_coverage_without_top_up") @db.Decimal(10, 2)
117
+
118
+ // Relations
119
+ applicationProductFeature ProductFeatures @relation(fields: [applicationProductFeatureId], references: [id])
120
+
121
+ @@map("calculations")
122
+ }
@@ -1,8 +1,8 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[commitment_id]` on the table `applicant_creditcard_commitments` will be added. If there are existing duplicate values, this will fail.
5
-
6
- */
7
- -- CreateIndex
8
- CREATE UNIQUE INDEX "applicant_creditcard_commitments_commitment_id_key" ON "applicant_creditcard_commitments"("commitment_id");
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[commitment_id]` on the table `applicant_creditcard_commitments` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+ -- CreateIndex
8
+ CREATE UNIQUE INDEX "applicant_creditcard_commitments_commitment_id_key" ON "applicant_creditcard_commitments"("commitment_id");
@@ -0,0 +1,15 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[application_id]` on the table `product_features` will be added. If there are existing duplicate values, this will fail.
5
+ - Added the required column `application_id` to the `product_features` table without a default value. This is not possible if the table is not empty.
6
+
7
+ */
8
+ -- AlterTable
9
+ ALTER TABLE "product_features" ADD COLUMN "application_id" TEXT NOT NULL;
10
+
11
+ -- CreateIndex
12
+ CREATE UNIQUE INDEX "product_features_application_id_key" ON "product_features"("application_id");
13
+
14
+ -- AddForeignKey
15
+ ALTER TABLE "product_features" ADD CONSTRAINT "product_features_application_id_fkey" FOREIGN KEY ("application_id") REFERENCES "applications"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -0,0 +1,163 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - The `reversion_rate_without_base_rate` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
5
+ - The `total_reversion_rate` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
6
+ - The `base_rate` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
7
+ - The `product_rate` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
8
+ - The `apr` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
9
+ - The `rental_coverage` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
10
+ - The `reimbursement` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
11
+ - The `reimbursement_per_pound` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
12
+ - The `stressed_apr` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
13
+ - The `stressed_rate` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
14
+ - The `stressed_repayment` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
15
+ - The `total_term_in_months` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
16
+ - The `variable_term` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
17
+ - The `total_fee_payable` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
18
+ - The `total_reimbursement_with_fee` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
19
+ - The `final_rent_payment` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
20
+ - The `client_deposit` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
21
+ - The `first_rent_payment` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
22
+ - The `stressed_payment` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
23
+ - The `stressed_payment_rate` column on the `product_features` table would be dropped and recreated. This will lead to data loss if there is data in the column.
24
+ - You are about to alter the column `market_value` on the `properties` table. The data in that column could be lost. The data in that column will be cast from `Decimal(12,2)` to `Decimal(10,2)`.
25
+ - You are about to alter the column `monthly_rent` on the `properties` table. The data in that column could be lost. The data in that column will be cast from `Decimal(12,2)` to `Decimal(10,2)`.
26
+ - You are about to alter the column `monthly_repayment` on the `properties` table. The data in that column could be lost. The data in that column will be cast from `Decimal(12,2)` to `Decimal(10,2)`.
27
+ - You are about to alter the column `original_loan_balance` on the `properties` table. The data in that column could be lost. The data in that column will be cast from `Decimal(12,2)` to `Decimal(10,2)`.
28
+ - You are about to alter the column `outstanding_balance` on the `properties` table. The data in that column could be lost. The data in that column will be cast from `Decimal(12,2)` to `Decimal(10,2)`.
29
+ - Changed the type of `client_advance` on the `product_features` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
30
+ - Changed the type of `ltv` on the `product_features` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
31
+ - Changed the type of `repayment` on the `product_features` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
32
+ - Changed the type of `variable_repayment` on the `product_features` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
33
+ - Changed the type of `initial_rate` on the `product_features` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
34
+ - Changed the type of `fixed_term` on the `product_features` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
35
+
36
+ */
37
+ -- AlterTable
38
+ ALTER TABLE "product_features" ADD COLUMN "cashflow_periods_total_no_of_payments" INTEGER,
39
+ DROP COLUMN "client_advance",
40
+ ADD COLUMN "client_advance" INTEGER NOT NULL,
41
+ DROP COLUMN "ltv",
42
+ ADD COLUMN "ltv" DECIMAL(10,2) NOT NULL,
43
+ DROP COLUMN "repayment",
44
+ ADD COLUMN "repayment" DECIMAL(10,2) NOT NULL,
45
+ DROP COLUMN "variable_repayment",
46
+ ADD COLUMN "variable_repayment" DECIMAL(10,2) NOT NULL,
47
+ DROP COLUMN "reversion_rate_without_base_rate",
48
+ ADD COLUMN "reversion_rate_without_base_rate" DECIMAL(10,2),
49
+ DROP COLUMN "total_reversion_rate",
50
+ ADD COLUMN "total_reversion_rate" DECIMAL(10,2),
51
+ DROP COLUMN "initial_rate",
52
+ ADD COLUMN "initial_rate" DECIMAL(10,2) NOT NULL,
53
+ DROP COLUMN "fixed_term",
54
+ ADD COLUMN "fixed_term" INTEGER NOT NULL,
55
+ DROP COLUMN "base_rate",
56
+ ADD COLUMN "base_rate" DECIMAL(10,2),
57
+ DROP COLUMN "product_rate",
58
+ ADD COLUMN "product_rate" DECIMAL(10,2),
59
+ DROP COLUMN "apr",
60
+ ADD COLUMN "apr" DECIMAL(10,2),
61
+ DROP COLUMN "rental_coverage",
62
+ ADD COLUMN "rental_coverage" DECIMAL(10,2),
63
+ DROP COLUMN "reimbursement",
64
+ ADD COLUMN "reimbursement" DECIMAL(10,2),
65
+ DROP COLUMN "reimbursement_per_pound",
66
+ ADD COLUMN "reimbursement_per_pound" DECIMAL(10,2),
67
+ DROP COLUMN "stressed_apr",
68
+ ADD COLUMN "stressed_apr" DECIMAL(10,2),
69
+ DROP COLUMN "stressed_rate",
70
+ ADD COLUMN "stressed_rate" DECIMAL(10,2),
71
+ DROP COLUMN "stressed_repayment",
72
+ ADD COLUMN "stressed_repayment" DECIMAL(10,2),
73
+ DROP COLUMN "total_term_in_months",
74
+ ADD COLUMN "total_term_in_months" INTEGER,
75
+ DROP COLUMN "variable_term",
76
+ ADD COLUMN "variable_term" INTEGER,
77
+ DROP COLUMN "total_fee_payable",
78
+ ADD COLUMN "total_fee_payable" INTEGER,
79
+ DROP COLUMN "total_reimbursement_with_fee",
80
+ ADD COLUMN "total_reimbursement_with_fee" DECIMAL(10,2),
81
+ DROP COLUMN "final_rent_payment",
82
+ ADD COLUMN "final_rent_payment" INTEGER,
83
+ DROP COLUMN "client_deposit",
84
+ ADD COLUMN "client_deposit" INTEGER,
85
+ DROP COLUMN "first_rent_payment",
86
+ ADD COLUMN "first_rent_payment" DECIMAL(10,2),
87
+ DROP COLUMN "stressed_payment",
88
+ ADD COLUMN "stressed_payment" DECIMAL(10,2),
89
+ DROP COLUMN "stressed_payment_rate",
90
+ ADD COLUMN "stressed_payment_rate" DECIMAL(10,2);
91
+
92
+ -- AlterTable
93
+ ALTER TABLE "properties" ALTER COLUMN "market_value" SET DATA TYPE DECIMAL(10,2),
94
+ ALTER COLUMN "monthly_rent" SET DATA TYPE DECIMAL(10,2),
95
+ ALTER COLUMN "monthly_repayment" SET DATA TYPE DECIMAL(10,2),
96
+ ALTER COLUMN "original_loan_balance" SET DATA TYPE DECIMAL(10,2),
97
+ ALTER COLUMN "outstanding_balance" SET DATA TYPE DECIMAL(10,2);
98
+
99
+ -- CreateTable
100
+ CREATE TABLE "fees" (
101
+ "id" TEXT NOT NULL,
102
+ "application_product_feature_id" TEXT NOT NULL,
103
+ "fee_type" TEXT NOT NULL,
104
+ "description" TEXT NOT NULL,
105
+ "fee_amount" INTEGER NOT NULL,
106
+ "rate" DECIMAL(10,2) NOT NULL,
107
+ "added_to_loan" BOOLEAN NOT NULL DEFAULT false,
108
+ "allow_override" BOOLEAN NOT NULL DEFAULT false,
109
+ "additional_data" JSONB,
110
+
111
+ CONSTRAINT "fees_pkey" PRIMARY KEY ("id")
112
+ );
113
+
114
+ -- CreateTable
115
+ CREATE TABLE "cashflow_periods" (
116
+ "id" TEXT NOT NULL,
117
+ "application_product_feature_id" TEXT NOT NULL,
118
+ "type" TEXT NOT NULL,
119
+ "from" INTEGER,
120
+ "to" INTEGER,
121
+ "instalment_amount" DECIMAL(10,2),
122
+ "instalment_interest" DECIMAL(10,2),
123
+ "instalment_capital_repaid" DECIMAL(10,2),
124
+ "other_costs" DECIMAL(10,2),
125
+ "outstanding_capital" DECIMAL(10,2),
126
+
127
+ CONSTRAINT "cashflow_periods_pkey" PRIMARY KEY ("id")
128
+ );
129
+
130
+ -- CreateTable
131
+ CREATE TABLE "calculations" (
132
+ "id" TEXT NOT NULL,
133
+ "application_product_feature_id" TEXT NOT NULL,
134
+ "ltv" DECIMAL(10,2),
135
+ "rental_coverage_ratio_rate" DECIMAL(10,2),
136
+ "bank_contribution_rate" DECIMAL(10,2),
137
+ "bank_initial_share_rate" DECIMAL(10,2),
138
+ "total_amount_payable" DECIMAL(10,2),
139
+ "fixed_monthly_payment" DECIMAL(10,2),
140
+ "fixed_monthly_capital" DECIMAL(10,2),
141
+ "fixed_monthly_interest" DECIMAL(10,2),
142
+ "variable_monthly_payment" DECIMAL(10,2),
143
+ "summary_total" DECIMAL(10,2),
144
+ "reimbursement_per_pound" DECIMAL(10,2),
145
+ "stressed_payment" DECIMAL(10,2),
146
+ "stressed_payment_rate" DECIMAL(10,2),
147
+ "rental_coverage" DECIMAL(10,2),
148
+ "rental_coverage_without_top_up" DECIMAL(10,2),
149
+
150
+ CONSTRAINT "calculations_pkey" PRIMARY KEY ("id")
151
+ );
152
+
153
+ -- CreateIndex
154
+ CREATE UNIQUE INDEX "calculations_application_product_feature_id_key" ON "calculations"("application_product_feature_id");
155
+
156
+ -- AddForeignKey
157
+ ALTER TABLE "fees" ADD CONSTRAINT "fees_application_product_feature_id_fkey" FOREIGN KEY ("application_product_feature_id") REFERENCES "product_features"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
158
+
159
+ -- AddForeignKey
160
+ ALTER TABLE "cashflow_periods" ADD CONSTRAINT "cashflow_periods_application_product_feature_id_fkey" FOREIGN KEY ("application_product_feature_id") REFERENCES "product_features"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
161
+
162
+ -- AddForeignKey
163
+ ALTER TABLE "calculations" ADD CONSTRAINT "calculations_application_product_feature_id_fkey" FOREIGN KEY ("application_product_feature_id") REFERENCES "product_features"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -9,13 +9,13 @@ model Property {
9
9
  addressLine3 String? @map("address_line3") @db.VarChar(35)
10
10
  city String? @map("city") @db.VarChar(30)
11
11
  countryLid String @map("country_lid")
12
- marketValue Decimal @default(0.00) @map("market_value") @db.Decimal(12, 2)
12
+ marketValue Decimal @default(0.00) @map("market_value") @db.Decimal(10, 2)
13
13
  lender String @map("lender") @db.VarChar(35)
14
14
  remainingTerm Int @map("remaining_term")
15
- monthlyRepayment Decimal @default(0.00) @map("monthly_repayment") @db.Decimal(12, 2)
16
- monthlyRent Decimal @default(0.00) @map("monthly_rent") @db.Decimal(12, 2)
17
- originalLoanBalance Decimal @default(0.00) @map("original_loan_balance") @db.Decimal(12, 2)
18
- outstandingBalance Decimal @default(0.00) @map("outstanding_balance") @db.Decimal(12, 2)
15
+ monthlyRepayment Decimal @default(0.00) @map("monthly_repayment") @db.Decimal(10, 2)
16
+ monthlyRent Decimal @default(0.00) @map("monthly_rent") @db.Decimal(10, 2)
17
+ originalLoanBalance Decimal @default(0.00) @map("original_loan_balance") @db.Decimal(10, 2)
18
+ outstandingBalance Decimal @default(0.00) @map("outstanding_balance") @db.Decimal(10, 2)
19
19
  associatedLoanPartiesIds String[] @map("associated_loan_parties_ids")
20
20
  otherOwnershipParties String? @map("other_ownership_parties") @db.VarChar(500)
21
21
  portfolioFile String? @map("portfolio_file")
@@ -1554,24 +1554,25 @@ model Application {
1554
1554
  applicantIds String[] @map("applicant_ids")
1555
1555
  propertyIds String[] @map("property_ids")
1556
1556
  createdAt DateTime @default(now()) @map("created_at")
1557
- updatedAt DateTime @updatedAt @default(now()) @map("updated_at")
1557
+ updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
1558
1558
 
1559
1559
  // Relations
1560
- broker Broker? @relation("ApplicationBroker", fields: [brokerId], references: [id])
1561
- security Security? @relation("ApplicationSecurity")
1562
- solicitor Solicitor? @relation("ApplicationSolicitor")
1563
- product Product? @relation("ApplicationProduct", fields: [productId], references: [id])
1564
- directDebit ApplicationDirectDebit? @relation("ApplicationDirectDebit")
1565
- creditProfile ApplicationCreditProfile? @relation("ApplicationCreditProfile")
1566
- mortgage ApplicationMortgage? @relation("ApplicationMortgage")
1567
- company ApplicationCompany? @relation("ApplicationCompany")
1568
- rationale ApplicationRationale? @relation("ApplicationRationale")
1569
- applicants Applicant[] @relation("ApplicationApplicants")
1570
- properties Property[] @relation("ApplicationProperties")
1571
- documents ApplicationDocument[]
1572
- notes ApplicationNote[]
1573
- audits ApplicationAudit[]
1574
- products ApplicationProduct[] @relation("ApplicationProducts")
1560
+ broker Broker? @relation("ApplicationBroker", fields: [brokerId], references: [id])
1561
+ security Security? @relation("ApplicationSecurity")
1562
+ solicitor Solicitor? @relation("ApplicationSolicitor")
1563
+ product Product? @relation("ApplicationProduct", fields: [productId], references: [id])
1564
+ directDebit ApplicationDirectDebit? @relation("ApplicationDirectDebit")
1565
+ creditProfile ApplicationCreditProfile? @relation("ApplicationCreditProfile")
1566
+ mortgage ApplicationMortgage? @relation("ApplicationMortgage")
1567
+ company ApplicationCompany? @relation("ApplicationCompany")
1568
+ rationale ApplicationRationale? @relation("ApplicationRationale")
1569
+ productFeatures ProductFeatures? @relation("ApplicationProductFeature")
1570
+ applicants Applicant[] @relation("ApplicationApplicants")
1571
+ properties Property[] @relation("ApplicationProperties")
1572
+ documents ApplicationDocument[]
1573
+ notes ApplicationNote[]
1574
+ audits ApplicationAudit[]
1575
+ products ApplicationProduct[] @relation("ApplicationProducts")
1575
1576
 
1576
1577
  // Lookup relations
1577
1578
  applicationType Lookup @relation("ApplicationType", fields: [applicationTypeLid], references: [id])
@@ -1669,58 +1670,126 @@ model ChecklistItem {
1669
1670
 
1670
1671
  // From prisma/applications/product-features.prisma
1671
1672
  model ProductFeatures {
1672
- id String @id @default(uuid())
1673
- name String @map("name")
1674
- clientAdvance String @map("client_advance")
1675
- ltv String @map("ltv")
1676
- repayment String @map("repayment")
1677
- variableRepayment String @map("variable_repayment")
1678
- reversionRateWithoutBaseRate String? @map("reversion_rate_without_base_rate")
1679
- totalReversionRate String? @map("total_reversion_rate")
1680
- initialRate String @map("initial_rate")
1681
- fixedTerm String @map("fixed_term")
1682
- fixedTermEndDate String? @map("fixed_term_end_date")
1683
- baseRate String? @map("base_rate")
1684
- productRate String? @map("product_rate")
1685
- apr String? @map("apr")
1686
- rentalCoverage String? @map("rental_coverage")
1687
- repaymentType String? @map("repayment_type")
1688
- applicationCategory String? @map("application_category")
1689
- securityType String? @map("security_type")
1690
- erc String? @map("erc")
1691
- loanType String? @map("loan_type")
1692
- maxLtvLimit String? @map("max_ltv_limit")
1693
- reimbursement String? @map("reimbursement")
1694
- reimbursementPerPound String? @map("reimbursement_per_pound")
1695
- stressedApr String? @map("stressed_apr")
1696
- stressedRate String? @map("stressed_rate")
1697
- stressedRepayment String? @map("stressed_repayment")
1698
- liborFloorRate String? @map("libor_floor_rate")
1699
- totalTermInMonths String? @map("total_term_in_months")
1700
- chargeType String @default("") @map("charge_type")
1701
- productCategory String @default("") @map("product_category")
1702
- ercCode String @default("") @map("erc_code")
1703
- variableTerm String? @map("variable_term")
1704
- totalFeePayable String? @map("total_fee_payable")
1705
- dipIssueDate String? @map("dip_issue_date")
1706
- estimatedCompletionDate String? @map("estimated_completion_date")
1707
- dipExpiryDate String? @map("dip_expiry_date")
1708
- fixedRepaymentUntillDate String? @map("fixed_repayment_untill_date")
1709
- rentalReviewDate String? @map("rental_review_date")
1710
- totalReimbursementWithFee String? @map("total_reimbursement_with_fee")
1711
- finalRentPayment String? @map("final_rent_payment")
1712
- clientDeposit String? @map("client_deposit")
1713
- firstRentPayment String? @map("first_rent_payment")
1714
- ercFeatures Json? @map("erc_features")
1715
- icr String? @map("icr")
1716
- ufssProductCode String? @map("ufss_product_code")
1717
- ufssInterestRateCode String? @map("ufss_interest_rate_code")
1718
- stressedPayment String? @map("stressed_payment")
1719
- stressedPaymentRate String? @map("stressed_payment_rate")
1720
- createdAt DateTime @default(now()) @map("created_at")
1721
- updatedAt DateTime @updatedAt @map("updated_at")
1673
+ id String @id @default(uuid())
1674
+ applicationId String @unique @map("application_id")
1675
+ name String @map("name")
1676
+ clientAdvance Int @map("client_advance")
1677
+ ltv Decimal @map("ltv") @db.Decimal(10, 2)
1678
+ repayment Decimal @map("repayment") @db.Decimal(10, 2)
1679
+ variableRepayment Decimal @map("variable_repayment") @db.Decimal(10, 2)
1680
+ reversionRateWithoutBaseRate Decimal? @map("reversion_rate_without_base_rate") @db.Decimal(10, 2)
1681
+ totalReversionRate Decimal? @map("total_reversion_rate") @db.Decimal(10, 2)
1682
+ initialRate Decimal @map("initial_rate") @db.Decimal(10, 2)
1683
+ fixedTerm Int @map("fixed_term")
1684
+ fixedTermEndDate String? @map("fixed_term_end_date")
1685
+ baseRate Decimal? @map("base_rate") @db.Decimal(10, 2)
1686
+ productRate Decimal? @map("product_rate") @db.Decimal(10, 2)
1687
+ apr Decimal? @map("apr") @db.Decimal(10, 2)
1688
+ rentalCoverage Decimal? @map("rental_coverage") @db.Decimal(10, 2)
1689
+ repaymentType String? @map("repayment_type")
1690
+ applicationCategory String? @map("application_category")
1691
+ securityType String? @map("security_type")
1692
+ erc String? @map("erc")
1693
+ loanType String? @map("loan_type")
1694
+ maxLtvLimit String? @map("max_ltv_limit")
1695
+ reimbursement Decimal? @map("reimbursement") @db.Decimal(10, 2)
1696
+ reimbursementPerPound Decimal? @map("reimbursement_per_pound") @db.Decimal(10, 2)
1697
+ stressedApr Decimal? @map("stressed_apr") @db.Decimal(10, 2)
1698
+ stressedRate Decimal? @map("stressed_rate") @db.Decimal(10, 2)
1699
+ stressedRepayment Decimal? @map("stressed_repayment") @db.Decimal(10, 2)
1700
+ liborFloorRate String? @map("libor_floor_rate")
1701
+ totalTermInMonths Int? @map("total_term_in_months")
1702
+ chargeType String @default("") @map("charge_type")
1703
+ productCategory String @default("") @map("product_category")
1704
+ ercCode String @default("") @map("erc_code")
1705
+ variableTerm Int? @map("variable_term")
1706
+ totalFeePayable Int? @map("total_fee_payable")
1707
+ dipIssueDate String? @map("dip_issue_date")
1708
+ estimatedCompletionDate String? @map("estimated_completion_date")
1709
+ dipExpiryDate String? @map("dip_expiry_date")
1710
+ fixedRepaymentUntillDate String? @map("fixed_repayment_untill_date")
1711
+ rentalReviewDate String? @map("rental_review_date")
1712
+ totalReimbursementWithFee Decimal? @map("total_reimbursement_with_fee") @db.Decimal(10, 2)
1713
+ finalRentPayment Int? @map("final_rent_payment")
1714
+ clientDeposit Int? @map("client_deposit")
1715
+ firstRentPayment Decimal? @map("first_rent_payment") @db.Decimal(10, 2)
1716
+ ercFeatures Json? @map("erc_features")
1717
+ icr String? @map("icr")
1718
+ ufssProductCode String? @map("ufss_product_code")
1719
+ ufssInterestRateCode String? @map("ufss_interest_rate_code")
1720
+ stressedPayment Decimal? @map("stressed_payment") @db.Decimal(10, 2)
1721
+ stressedPaymentRate Decimal? @map("stressed_payment_rate") @db.Decimal(10, 2)
1722
+ createdAt DateTime @default(now()) @map("created_at")
1723
+ updatedAt DateTime @updatedAt @map("updated_at")
1724
+ cashflowPeriodsTotalNoOfPayments Int? @map("cashflow_periods_total_no_of_payments")
1725
+ fees Fee[]
1726
+ cashflowPeriods CashflowPeriod[]
1727
+ calculations Calculations?
1728
+
1729
+ // Relationships
1730
+ application Application @relation("ApplicationProductFeature", fields: [applicationId], references: [id])
1722
1731
 
1723
1732
  @@map("product_features")
1733
+ }
1734
+
1735
+ model Fee {
1736
+ id String @id @default(uuid())
1737
+ applicationProductFeatureId String @map("application_product_feature_id")
1738
+ feeType String @map("fee_type")
1739
+ description String @map("description")
1740
+ feeAmount Int @map("fee_amount")
1741
+ rate Decimal @map("rate") @db.Decimal(10, 2)
1742
+ addedToLoan Boolean @default(false) @map("added_to_loan")
1743
+ allowOverride Boolean @default(false) @map("allow_override")
1744
+ additionalData Json? @map("additional_data")
1745
+
1746
+ // Relations
1747
+ applicationProductFeature ProductFeatures @relation(fields: [applicationProductFeatureId], references: [id])
1748
+
1749
+ @@map("fees")
1750
+ }
1751
+
1752
+ model CashflowPeriod {
1753
+ id String @id @default(uuid())
1754
+ applicationProductFeatureId String @map("application_product_feature_id")
1755
+ type String @map("type")
1756
+ from Int? @map("from")
1757
+ to Int? @map("to")
1758
+ instalmentAmount Decimal? @map("instalment_amount") @db.Decimal(10, 2)
1759
+ instalmentInterest Decimal? @map("instalment_interest") @db.Decimal(10, 2)
1760
+ instalmentCapitalRepaid Decimal? @map("instalment_capital_repaid") @db.Decimal(10, 2)
1761
+ otherCosts Decimal? @map("other_costs") @db.Decimal(10, 2)
1762
+ outstandingCapital Decimal? @map("outstanding_capital") @db.Decimal(10, 2)
1763
+
1764
+ // Relations
1765
+ applicationProductFeature ProductFeatures @relation(fields: [applicationProductFeatureId], references: [id])
1766
+
1767
+ @@map("cashflow_periods")
1768
+ }
1769
+
1770
+ model Calculations {
1771
+ id String @id @default(uuid())
1772
+ applicationProductFeatureId String @unique @map("application_product_feature_id")
1773
+ ltv Decimal? @map("ltv") @db.Decimal(10, 2)
1774
+ rentalCoverageRatioRate Decimal? @map("rental_coverage_ratio_rate") @db.Decimal(10, 2)
1775
+ bankContributionRate Decimal? @map("bank_contribution_rate") @db.Decimal(10, 2)
1776
+ bankInitialShareRate Decimal? @map("bank_initial_share_rate") @db.Decimal(10, 2)
1777
+ totalAmountPayable Decimal? @map("total_amount_payable") @db.Decimal(10, 2)
1778
+ fixedMonthlyPayment Decimal? @map("fixed_monthly_payment") @db.Decimal(10, 2)
1779
+ fixedMonthlyCapital Decimal? @map("fixed_monthly_capital") @db.Decimal(10, 2)
1780
+ fixedMonthlyInterest Decimal? @map("fixed_monthly_interest") @db.Decimal(10, 2)
1781
+ variableMonthlyPayment Decimal? @map("variable_monthly_payment") @db.Decimal(10, 2)
1782
+ summaryTotal Decimal? @map("summary_total") @db.Decimal(10, 2)
1783
+ reimbursementPerPound Decimal? @map("reimbursement_per_pound") @db.Decimal(10, 2)
1784
+ stressedPayment Decimal? @map("stressed_payment") @db.Decimal(10, 2)
1785
+ stressedPaymentRate Decimal? @map("stressed_payment_rate") @db.Decimal(10, 2)
1786
+ rentalCoverage Decimal? @map("rental_coverage") @db.Decimal(10, 2)
1787
+ rentalCoverageWithoutTopUp Decimal? @map("rental_coverage_without_top_up") @db.Decimal(10, 2)
1788
+
1789
+ // Relations
1790
+ applicationProductFeature ProductFeatures @relation(fields: [applicationProductFeatureId], references: [id])
1791
+
1792
+ @@map("calculations")
1724
1793
  }
1725
1794
 
1726
1795
  // From prisma/applications/solicitor.prisma
@@ -1770,13 +1839,13 @@ model Property {
1770
1839
  addressLine3 String? @map("address_line3") @db.VarChar(35)
1771
1840
  city String? @map("city") @db.VarChar(30)
1772
1841
  countryLid String @map("country_lid")
1773
- marketValue Decimal @default(0.00) @map("market_value") @db.Decimal(12, 2)
1842
+ marketValue Decimal @default(0.00) @map("market_value") @db.Decimal(10, 2)
1774
1843
  lender String @map("lender") @db.VarChar(35)
1775
1844
  remainingTerm Int @map("remaining_term")
1776
- monthlyRepayment Decimal @default(0.00) @map("monthly_repayment") @db.Decimal(12, 2)
1777
- monthlyRent Decimal @default(0.00) @map("monthly_rent") @db.Decimal(12, 2)
1778
- originalLoanBalance Decimal @default(0.00) @map("original_loan_balance") @db.Decimal(12, 2)
1779
- outstandingBalance Decimal @default(0.00) @map("outstanding_balance") @db.Decimal(12, 2)
1845
+ monthlyRepayment Decimal @default(0.00) @map("monthly_repayment") @db.Decimal(10, 2)
1846
+ monthlyRent Decimal @default(0.00) @map("monthly_rent") @db.Decimal(10, 2)
1847
+ originalLoanBalance Decimal @default(0.00) @map("original_loan_balance") @db.Decimal(10, 2)
1848
+ outstandingBalance Decimal @default(0.00) @map("outstanding_balance") @db.Decimal(10, 2)
1780
1849
  associatedLoanPartiesIds String[] @map("associated_loan_parties_ids")
1781
1850
  otherOwnershipParties String? @map("other_ownership_parties") @db.VarChar(500)
1782
1851
  portfolioFile String? @map("portfolio_file")