@dynamatix/gb-schemas 2.0.39 → 2.0.40

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,20 +1,29 @@
1
+ import { ApplicantEntity } from './applicant.entity';
2
+ import { LookupEntity } from '../shared/lookup.entity';
1
3
  export declare class LoanCommitmentEntity {
2
4
  id: string;
3
5
  applicantId: string;
4
6
  commitmentId: string;
5
- commitmentTypeLid?: string;
6
7
  lenderName: string;
7
- loanTypeLid: string;
8
- securityDetails: string;
9
- purpose?: string;
10
- doHaveSharedResponsibility: boolean;
11
- sharedMortgage: string;
8
+ loanTypeLid?: string;
9
+ securityDetails?: string;
10
+ purpose: string;
11
+ doHaveSharedResponsibility?: boolean;
12
+ sharedMortgage?: string;
12
13
  remainingTerm?: string;
13
14
  startDate: string;
14
15
  outstandingBalance: number;
15
16
  monthlyPayment: number;
17
+ source?: string;
18
+ isSelected?: boolean;
19
+ loanRationale?: string;
16
20
  createdAt: Date;
17
21
  updatedAt: Date;
22
+ applicant?: ApplicantEntity;
23
+ loanType?: LookupEntity;
18
24
  constructor(partial: Partial<LoanCommitmentEntity>);
25
+ get applicationId(): string | undefined;
26
+ get lendingType(): string | undefined;
27
+ get doHaveSharedResponsibilityDisplay(): string;
19
28
  }
20
29
  //# sourceMappingURL=loan-commitment.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loan-commitment.entity.d.ts","sourceRoot":"","sources":["../../../entities/applicants/loan-commitment.entity.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAoB;IAC7B,EAAE,EAAG,MAAM,CAAC;IACZ,WAAW,EAAG,MAAM,CAAC;IACrB,YAAY,EAAG,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,EAAG,MAAM,CAAC;IACrB,eAAe,EAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B,EAAG,OAAO,CAAC;IACrC,cAAc,EAAG,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAG,MAAM,CAAC;IACnB,kBAAkB,EAAG,MAAM,CAAC;IAC5B,cAAc,EAAG,MAAM,CAAC;IACxB,SAAS,EAAG,IAAI,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;gBAEL,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC;CAKrD"}
1
+ {"version":3,"file":"loan-commitment.entity.d.ts","sourceRoot":"","sources":["../../../entities/applicants/loan-commitment.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,oBAAoB;IAC7B,EAAE,EAAG,MAAM,CAAC;IACZ,WAAW,EAAG,MAAM,CAAC;IACrB,YAAY,EAAG,MAAM,CAAC;IACtB,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAG,MAAM,CAAC;IACjB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAG,MAAM,CAAC;IACnB,kBAAkB,EAAG,MAAM,CAAC;IAC5B,cAAc,EAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAG,IAAI,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,QAAQ,CAAC,EAAE,YAAY,CAAC;gBAEZ,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC;IAKlD,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,iCAAiC,IAAI,MAAM,CAE9C;CACJ"}
@@ -2,4 +2,14 @@ export class LoanCommitmentEntity {
2
2
  constructor(partial) {
3
3
  Object.assign(this, partial);
4
4
  }
5
+ // Virtual properties from Mongoose model
6
+ get applicationId() {
7
+ return this.applicant?.applicationId;
8
+ }
9
+ get lendingType() {
10
+ return this.applicant?.application?.lendingType?.name;
11
+ }
12
+ get doHaveSharedResponsibilityDisplay() {
13
+ return this.doHaveSharedResponsibility ? "Yes" : "No";
14
+ }
5
15
  }
@@ -1,24 +1,44 @@
1
+ import { ApplicantEntity } from './applicant.entity';
2
+ import { LookupEntity } from '../shared/lookup.entity';
3
+
1
4
  export class LoanCommitmentEntity {
2
5
  id!: string;
3
6
  applicantId!: string;
4
7
  commitmentId!: string;
5
- commitmentTypeLid?: string;
6
8
  lenderName!: string;
7
- loanTypeLid!: string;
8
- securityDetails!: string;
9
- purpose?: string;
10
- doHaveSharedResponsibility!: boolean;
11
- sharedMortgage!: string;
9
+ loanTypeLid?: string;
10
+ securityDetails?: string;
11
+ purpose!: string;
12
+ doHaveSharedResponsibility?: boolean;
13
+ sharedMortgage?: string;
12
14
  remainingTerm?: string;
13
15
  startDate!: string;
14
16
  outstandingBalance!: number;
15
17
  monthlyPayment!: number;
18
+ source?: string;
19
+ isSelected?: boolean;
20
+ loanRationale?: string;
16
21
  createdAt!: Date;
17
22
  updatedAt!: Date;
18
23
 
24
+ // Relations
25
+ applicant?: ApplicantEntity;
26
+ loanType?: LookupEntity; // Relation field for loanType
27
+
19
28
  constructor(partial: Partial<LoanCommitmentEntity>) {
20
29
  Object.assign(this, partial);
21
30
  }
22
31
 
23
- // Add virtual fields in Mapper {commitmentType, loanType} etc
24
- }
32
+ // Virtual properties from Mongoose model
33
+ get applicationId(): string | undefined {
34
+ return this.applicant?.applicationId;
35
+ }
36
+
37
+ get lendingType(): string | undefined {
38
+ return this.applicant?.application?.lendingType?.name;
39
+ }
40
+
41
+ get doHaveSharedResponsibilityDisplay(): string {
42
+ return this.doHaveSharedResponsibility ? "Yes" : "No";
43
+ }
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.0.39",
3
+ "version": "2.0.40",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,26 +1,26 @@
1
1
  model LoanCommitment {
2
- id String @id @default(uuid())
3
- applicantId String @map("applicant_id")
4
- commitmentId String @map("commitment_id")
5
- commitmentTypeLid String? @map("commitment_type_lid")
6
- lenderName String @map("lender_name")
7
- loanTypeLid String @map("loan_type_lid")
8
- securityDetails String @map("security_details")
9
- purpose String? @map("purpose")
10
- doHaveSharedResponsibility Boolean @map("do_have_shared_responsibility")
11
- sharedMortgage String @map("shared_mortgage")
12
- remainingTerm String? @map("remaining_term")
13
- startDate String @map("start_date")
14
- outstandingBalance Decimal @map("outstanding_balance")
15
- monthlyPayment Decimal @map("monthly_payment")
16
- jointNames Boolean @map("joint_names")
17
- createdAt DateTime @default(now()) @map("created_at")
18
- updatedAt DateTime @updatedAt @map("updated_at")
2
+ id String @id @default(uuid())
3
+ applicantId String @map("applicant_id")
4
+ commitmentId String @unique @map("commitment_id")
5
+ lenderName String @map("lender_name")
6
+ loanTypeLid String? @map("loan_type_lid")
7
+ securityDetails String? @map("security_details")
8
+ purpose String @map("purpose")
9
+ doHaveSharedResponsibility Boolean? @map("do_have_shared_responsibility")
10
+ sharedMortgage String? @map("shared_mortgage")
11
+ remainingTerm String? @map("remaining_term")
12
+ startDate String @map("start_date")
13
+ outstandingBalance Decimal @map("outstanding_balance") @db.Decimal(10, 2)
14
+ monthlyPayment Decimal @map("monthly_payment") @db.Decimal(10, 2)
15
+ source String? @default("Broker") @map("source")
16
+ isSelected Boolean? @default(true) @map("is_selected")
17
+ loanRationale String? @default("") @map("loan_rationale")
18
+ createdAt DateTime @default(now()) @map("created_at")
19
+ updatedAt DateTime @updatedAt @map("updated_at")
19
20
 
20
21
  // Relations
21
- applicant Applicant @relation("ApplicantLoanCommitments", fields: [applicantId], references: [id])
22
- commitmentType Lookup? @relation("CommitmentType", fields: [commitmentTypeLid], references: [id])
23
- loanType Lookup @relation("LoanType", fields: [loanTypeLid], references: [id])
22
+ applicant Applicant @relation("ApplicantLoanCommitments", fields: [applicantId], references: [id])
23
+ loanType Lookup? @relation("LoanType", fields: [loanTypeLid], references: [id])
24
24
 
25
25
  @@map("applicant_loan_commitments")
26
- }
26
+ }
@@ -0,0 +1,33 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `commitment_type_lid` on the `applicant_loan_commitments` table. All the data in the column will be lost.
5
+ - You are about to drop the column `joint_names` on the `applicant_loan_commitments` table. All the data in the column will be lost.
6
+ - You are about to alter the column `outstanding_balance` on the `applicant_loan_commitments` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Decimal(10,2)`.
7
+ - You are about to alter the column `monthly_payment` on the `applicant_loan_commitments` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Decimal(10,2)`.
8
+ - A unique constraint covering the columns `[commitment_id]` on the table `applicant_loan_commitments` will be added. If there are existing duplicate values, this will fail.
9
+ - Made the column `purpose` on table `applicant_loan_commitments` required. This step will fail if there are existing NULL values in that column.
10
+
11
+ */
12
+ -- DropForeignKey
13
+ ALTER TABLE "applicant_loan_commitments" DROP CONSTRAINT "applicant_loan_commitments_commitment_type_lid_fkey";
14
+
15
+ -- DropForeignKey
16
+ ALTER TABLE "applicant_loan_commitments" DROP CONSTRAINT "applicant_loan_commitments_loan_type_lid_fkey";
17
+
18
+ -- AlterTable
19
+ ALTER TABLE "applicant_loan_commitments" DROP COLUMN "commitment_type_lid",
20
+ DROP COLUMN "joint_names",
21
+ ALTER COLUMN "loan_type_lid" DROP NOT NULL,
22
+ ALTER COLUMN "security_details" DROP NOT NULL,
23
+ ALTER COLUMN "purpose" SET NOT NULL,
24
+ ALTER COLUMN "do_have_shared_responsibility" DROP NOT NULL,
25
+ ALTER COLUMN "shared_mortgage" DROP NOT NULL,
26
+ ALTER COLUMN "outstanding_balance" SET DATA TYPE DECIMAL(10,2),
27
+ ALTER COLUMN "monthly_payment" SET DATA TYPE DECIMAL(10,2);
28
+
29
+ -- CreateIndex
30
+ CREATE UNIQUE INDEX "applicant_loan_commitments_commitment_id_key" ON "applicant_loan_commitments"("commitment_id");
31
+
32
+ -- AddForeignKey
33
+ ALTER TABLE "applicant_loan_commitments" ADD CONSTRAINT "applicant_loan_commitments_loan_type_lid_fkey" FOREIGN KEY ("loan_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,4 @@
1
+ -- AlterTable
2
+ ALTER TABLE "applicant_loan_commitments" ADD COLUMN "is_selected" BOOLEAN DEFAULT true,
3
+ ADD COLUMN "loan_rationale" TEXT DEFAULT '',
4
+ ADD COLUMN "source" TEXT DEFAULT 'Broker';
@@ -223,8 +223,7 @@ model Lookup {
223
223
  registeredCountry_incomes ApplicantIncome[] @relation("RegisteredCountry")
224
224
 
225
225
  // LoanCommitment Relations
226
- commitmentType_loanCommitments LoanCommitment[] @relation("CommitmentType")
227
- loanType_loanCommitments LoanCommitment[] @relation("LoanType")
226
+ loanType_loanCommitments LoanCommitment[] @relation("LoanType")
228
227
 
229
228
  // Applicant Relations
230
229
  addressCountry_applicants Applicant[] @relation("AddressCountry")
@@ -926,28 +925,28 @@ model CreditCardCommitment {
926
925
 
927
926
  // From prisma/applicants/loan-commitment.prisma
928
927
  model LoanCommitment {
929
- id String @id @default(uuid())
930
- applicantId String @map("applicant_id")
931
- commitmentId String @map("commitment_id")
932
- commitmentTypeLid String? @map("commitment_type_lid")
933
- lenderName String @map("lender_name")
934
- loanTypeLid String @map("loan_type_lid")
935
- securityDetails String @map("security_details")
936
- purpose String? @map("purpose")
937
- doHaveSharedResponsibility Boolean @map("do_have_shared_responsibility")
938
- sharedMortgage String @map("shared_mortgage")
939
- remainingTerm String? @map("remaining_term")
940
- startDate String @map("start_date")
941
- outstandingBalance Decimal @map("outstanding_balance")
942
- monthlyPayment Decimal @map("monthly_payment")
943
- jointNames Boolean @map("joint_names")
944
- createdAt DateTime @default(now()) @map("created_at")
945
- updatedAt DateTime @updatedAt @map("updated_at")
928
+ id String @id @default(uuid())
929
+ applicantId String @map("applicant_id")
930
+ commitmentId String @unique @map("commitment_id")
931
+ lenderName String @map("lender_name")
932
+ loanTypeLid String? @map("loan_type_lid")
933
+ securityDetails String? @map("security_details")
934
+ purpose String @map("purpose")
935
+ doHaveSharedResponsibility Boolean? @map("do_have_shared_responsibility")
936
+ sharedMortgage String? @map("shared_mortgage")
937
+ remainingTerm String? @map("remaining_term")
938
+ startDate String @map("start_date")
939
+ outstandingBalance Decimal @map("outstanding_balance") @db.Decimal(10, 2)
940
+ monthlyPayment Decimal @map("monthly_payment") @db.Decimal(10, 2)
941
+ source String? @default("Broker") @map("source")
942
+ isSelected Boolean? @default(true) @map("is_selected")
943
+ loanRationale String? @default("") @map("loan_rationale")
944
+ createdAt DateTime @default(now()) @map("created_at")
945
+ updatedAt DateTime @updatedAt @map("updated_at")
946
946
 
947
947
  // Relations
948
- applicant Applicant @relation("ApplicantLoanCommitments", fields: [applicantId], references: [id])
949
- commitmentType Lookup? @relation("CommitmentType", fields: [commitmentTypeLid], references: [id])
950
- loanType Lookup @relation("LoanType", fields: [loanTypeLid], references: [id])
948
+ applicant Applicant @relation("ApplicantLoanCommitments", fields: [applicantId], references: [id])
949
+ loanType Lookup? @relation("LoanType", fields: [loanTypeLid], references: [id])
951
950
 
952
951
  @@map("applicant_loan_commitments")
953
952
  }
@@ -102,8 +102,7 @@ model Lookup {
102
102
  registeredCountry_incomes ApplicantIncome[] @relation("RegisteredCountry")
103
103
 
104
104
  // LoanCommitment Relations
105
- commitmentType_loanCommitments LoanCommitment[] @relation("CommitmentType")
106
- loanType_loanCommitments LoanCommitment[] @relation("LoanType")
105
+ loanType_loanCommitments LoanCommitment[] @relation("LoanType")
107
106
 
108
107
  // Applicant Relations
109
108
  addressCountry_applicants Applicant[] @relation("AddressCountry")