@dynamatix/gb-schemas 2.0.46 → 2.0.47

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 (34) hide show
  1. package/dist/entities/applicants/applicant-share-holding.entity.d.ts +18 -0
  2. package/dist/entities/applicants/applicant-share-holding.entity.d.ts.map +1 -0
  3. package/dist/entities/applicants/applicant-share-holding.entity.js +5 -0
  4. package/dist/entities/applications/application-company.entity.d.ts +52 -4
  5. package/dist/entities/applications/application-company.entity.d.ts.map +1 -1
  6. package/dist/entities/applications/application-company.entity.js +10 -0
  7. package/dist/entities/applications/index.d.ts +2 -3
  8. package/dist/entities/applications/index.d.ts.map +1 -1
  9. package/dist/entities/applications/index.js +0 -1
  10. package/entities/applicants/applicant-share-holding.entity.ts +23 -0
  11. package/entities/applications/application-company.entity.ts +64 -5
  12. package/entities/applications/index.ts +0 -3
  13. package/package.json +1 -1
  14. package/prisma/applicants/applicant-share-holding.prisma +17 -0
  15. package/prisma/applications/application-company.prisma +50 -7
  16. package/prisma/applications/application.prisma +0 -1
  17. package/prisma/migrations/20250513143530_update_credit_card_commitment_schema/migration.sql +8 -8
  18. package/prisma/migrations/20250513170654_update_mortgage_commitment_schema/migration.sql +89 -89
  19. package/prisma/migrations/20250513183558_update_loan_commitment_schema/migration.sql +33 -33
  20. package/prisma/migrations/20250513184341_update_loan_commitment_schema/migration.sql +4 -4
  21. package/prisma/migrations/20250513202307_update_role_schema/migration.sql +12 -12
  22. package/prisma/migrations/20250514062536_update_role_group_schema/migration.sql +12 -12
  23. package/prisma/migrations/20250514064054_update_user_schema/migration.sql +12 -12
  24. package/prisma/migrations/20250514071524_update_user_schema/migration.sql +15 -15
  25. package/prisma/migrations/20250514072729_update_user_schema/migration.sql +18 -18
  26. package/prisma/migrations/20250514102042_update_user_rolegroup_role_schemas/migration.sql +9 -9
  27. package/prisma/migrations/20250514183537_update_application_company_schema/migration.sql +100 -0
  28. package/prisma/schema.prisma +73 -91
  29. package/prisma/shared/lookup.prisma +4 -5
  30. package/dist/entities/applications/company.entity.d.ts +0 -77
  31. package/dist/entities/applications/company.entity.d.ts.map +0 -1
  32. package/dist/entities/applications/company.entity.js +0 -23
  33. package/entities/applications/company.entity.ts +0 -102
  34. package/prisma/applications/company.prisma +0 -76
@@ -0,0 +1,18 @@
1
+ import { ApplicantEntity } from "../applicants/applicant.entity";
2
+ import { LookupEntity } from "../shared/lookup.entity";
3
+ import { ApplicationCompanyEntity } from "../applications/application-company.entity";
4
+ export declare class ApplicantShareholdingEntity {
5
+ id: string;
6
+ companyId: string;
7
+ applicantId: string;
8
+ applicantName: string;
9
+ directorShareholderLid?: string;
10
+ shareholding?: number;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ company?: ApplicationCompanyEntity;
14
+ applicant?: ApplicantEntity;
15
+ directorShareholder?: LookupEntity;
16
+ constructor(partial: Partial<ApplicantShareholdingEntity>);
17
+ }
18
+ //# sourceMappingURL=applicant-share-holding.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applicant-share-holding.entity.d.ts","sourceRoot":"","sources":["../../../entities/applicants/applicant-share-holding.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF,qBAAa,2BAA2B;IACpC,EAAE,EAAG,MAAM,CAAC;IACZ,SAAS,EAAG,MAAM,CAAC;IACnB,WAAW,EAAG,MAAM,CAAC;IACrB,aAAa,EAAG,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAG,IAAI,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;IAGjB,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,mBAAmB,CAAC,EAAE,YAAY,CAAC;gBAEvB,OAAO,EAAE,OAAO,CAAC,2BAA2B,CAAC;CAG5D"}
@@ -0,0 +1,5 @@
1
+ export class ApplicantShareholdingEntity {
2
+ constructor(partial) {
3
+ Object.assign(this, partial);
4
+ }
5
+ }
@@ -1,12 +1,60 @@
1
- import { ApplicationEntity } from './application.entity';
1
+ import { LookupEntity } from "../shared/lookup.entity";
2
+ import { ApplicationEntity } from "./application.entity";
3
+ import { ApplicantShareholdingEntity } from "../applicants/applicant-share-holding.entity";
2
4
  export declare class ApplicationCompanyEntity {
3
5
  id: string;
4
6
  applicationId: string;
5
- name: string;
6
- registrationNumber?: string;
7
+ pageValidFlag?: boolean;
8
+ registeredName: string;
9
+ businessTypeLid: string;
10
+ registeredNumber: number;
11
+ taxJurisdictionLid: string;
12
+ tradingSince: string;
13
+ natureOfBusiness: string;
14
+ yearEnd: string;
15
+ addressPostCode: string;
16
+ addressLine1: string;
17
+ addressLine2?: string;
18
+ addressLine3?: string;
19
+ addressCity?: string;
20
+ addressCountryLid: string;
21
+ yearEnd1: number;
22
+ turnoverYear1: number;
23
+ netProfitYear1: number;
24
+ yearEnd2: number;
25
+ turnoverYear2: number;
26
+ netProfitYear2: number;
27
+ yearEnd3: number;
28
+ turnoverYear3: number;
29
+ netProfitYear3: number;
30
+ companyCreditDefaults: string;
31
+ companyCountyCourtJudgment: string;
32
+ companySecuredArrears: string;
33
+ companyUnsecuredArrears: string;
34
+ companyBankruptcy: string;
35
+ companyBankruptcyYes: boolean;
36
+ companyBankruptcyNo: boolean;
37
+ companyCCJInLastThreeYearYes: boolean;
38
+ companyCCJInLastThreeYearNo: boolean;
39
+ companyDefaultsInLastYearYes: boolean;
40
+ companyDefaultsInLastYearNo: boolean;
41
+ companyAnyVoluntaryEnforcedPossessionYes: boolean;
42
+ companyAnyVoluntaryEnforcedPossessionNo: boolean;
43
+ doYouKnowRegisteredNumber: boolean;
44
+ sicCodes: string[];
45
+ epc: string;
46
+ remainingLease: string;
47
+ dateOfIncorporation?: string;
7
48
  createdAt: Date;
8
49
  updatedAt: Date;
9
- application: ApplicationEntity;
50
+ application?: ApplicationEntity;
51
+ businessType?: LookupEntity;
52
+ taxJurisdiction?: LookupEntity;
53
+ addressCountry?: LookupEntity;
54
+ applicantShareholdings?: ApplicantShareholdingEntity[];
10
55
  constructor(partial: Partial<ApplicationCompanyEntity>);
56
+ get businessTypeName(): string | null;
57
+ get taxJurisdictionName(): string | null;
58
+ get addressCountryName(): string | null;
11
59
  }
12
60
  //# sourceMappingURL=application-company.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-company.entity.d.ts","sourceRoot":"","sources":["../../../entities/applications/application-company.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qBAAa,wBAAwB;IACjC,EAAE,EAAG,MAAM,CAAC;IACZ,aAAa,EAAG,MAAM,CAAC;IACvB,IAAI,EAAG,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAG,IAAI,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;IAGjB,WAAW,EAAG,iBAAiB,CAAC;gBAEpB,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC;CAGzD"}
1
+ {"version":3,"file":"application-company.entity.d.ts","sourceRoot":"","sources":["../../../entities/applications/application-company.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAE3F,qBAAa,wBAAwB;IACjC,EAAE,EAAG,MAAM,CAAC;IACZ,aAAa,EAAG,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,EAAG,MAAM,CAAC;IACxB,eAAe,EAAG,MAAM,CAAC;IACzB,gBAAgB,EAAG,MAAM,CAAC;IAC1B,kBAAkB,EAAG,MAAM,CAAC;IAC5B,YAAY,EAAG,MAAM,CAAC;IACtB,gBAAgB,EAAG,MAAM,CAAC;IAC1B,OAAO,EAAG,MAAM,CAAC;IACjB,eAAe,EAAG,MAAM,CAAC;IACzB,YAAY,EAAG,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAG,MAAM,CAAC;IAC3B,QAAQ,EAAG,MAAM,CAAC;IAClB,aAAa,EAAG,MAAM,CAAC;IACvB,cAAc,EAAG,MAAM,CAAC;IACxB,QAAQ,EAAG,MAAM,CAAC;IAClB,aAAa,EAAG,MAAM,CAAC;IACvB,cAAc,EAAG,MAAM,CAAC;IACxB,QAAQ,EAAG,MAAM,CAAC;IAClB,aAAa,EAAG,MAAM,CAAC;IACvB,cAAc,EAAG,MAAM,CAAC;IACxB,qBAAqB,EAAG,MAAM,CAAC;IAC/B,0BAA0B,EAAG,MAAM,CAAC;IACpC,qBAAqB,EAAG,MAAM,CAAC;IAC/B,uBAAuB,EAAG,MAAM,CAAC;IACjC,iBAAiB,EAAG,MAAM,CAAC;IAC3B,oBAAoB,EAAG,OAAO,CAAC;IAC/B,mBAAmB,EAAG,OAAO,CAAC;IAC9B,4BAA4B,EAAG,OAAO,CAAC;IACvC,2BAA2B,EAAG,OAAO,CAAC;IACtC,4BAA4B,EAAG,OAAO,CAAC;IACvC,2BAA2B,EAAG,OAAO,CAAC;IACtC,wCAAwC,EAAG,OAAO,CAAC;IACnD,uCAAuC,EAAG,OAAO,CAAC;IAClD,yBAAyB,EAAG,OAAO,CAAC;IACpC,QAAQ,EAAG,MAAM,EAAE,CAAC;IACpB,GAAG,EAAG,MAAM,CAAC;IACb,cAAc,EAAG,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAG,IAAI,CAAC;IACjB,SAAS,EAAG,IAAI,CAAC;IAGjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,sBAAsB,CAAC,EAAE,2BAA2B,EAAE,CAAC;gBAE3C,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC;IAKtD,IAAI,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEpC;IAED,IAAI,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAEvC;IAED,IAAI,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAEtC;CACJ"}
@@ -2,4 +2,14 @@ export class ApplicationCompanyEntity {
2
2
  constructor(partial) {
3
3
  Object.assign(this, partial);
4
4
  }
5
+ // Virtual fields from Mongoose model
6
+ get businessTypeName() {
7
+ return this.businessType?.name ?? null;
8
+ }
9
+ get taxJurisdictionName() {
10
+ return this.taxJurisdiction?.name ?? null;
11
+ }
12
+ get addressCountryName() {
13
+ return this.addressCountry?.name ?? null;
14
+ }
5
15
  }
@@ -1,11 +1,10 @@
1
- import type { Application, ProductFeatures, Solicitor, Broker, ChecklistItem, Company, ApplicationRationale, ApplicationProduct, ApplicationNote, ApplicationOffer, ApplicationOnboarding, ApplicationIllustration, ApplicationLegal, ApplicationMortgage, ApplicationDocument, ApplicationFieldConfig, ApplicationAudit, ApplicationCompany, ApplicationDirectDebit } from '@prisma/client';
2
- export type { Application, ProductFeatures, Solicitor, Broker, ChecklistItem, Company, ApplicationRationale, ApplicationProduct, ApplicationNote, ApplicationOffer, ApplicationOnboarding, ApplicationIllustration, ApplicationLegal, ApplicationMortgage, ApplicationDocument, ApplicationFieldConfig, ApplicationAudit, ApplicationCompany, ApplicationDirectDebit };
1
+ import type { Application, ProductFeatures, Solicitor, Broker, ChecklistItem, ApplicationRationale, ApplicationProduct, ApplicationNote, ApplicationOffer, ApplicationOnboarding, ApplicationIllustration, ApplicationLegal, ApplicationMortgage, ApplicationDocument, ApplicationFieldConfig, ApplicationAudit, ApplicationCompany, ApplicationDirectDebit } from '@prisma/client';
2
+ export type { Application, ProductFeatures, Solicitor, Broker, ChecklistItem, ApplicationRationale, ApplicationProduct, ApplicationNote, ApplicationOffer, ApplicationOnboarding, ApplicationIllustration, ApplicationLegal, ApplicationMortgage, ApplicationDocument, ApplicationFieldConfig, ApplicationAudit, ApplicationCompany, ApplicationDirectDebit };
3
3
  export * from './application.entity';
4
4
  export * from './product-features.entity';
5
5
  export * from './solicitor.entity';
6
6
  export * from './broker.entity';
7
7
  export * from './checklist-item.entity';
8
- export * from './company.entity';
9
8
  export * from './application-credit-profile.entity';
10
9
  export * from './application-rationale.entity';
11
10
  export * from './application-product.entity';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../entities/applications/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,EACP,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACzB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACR,WAAW,EACX,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,EACP,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACzB,CAAC;AAGF,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../entities/applications/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACzB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACR,WAAW,EACX,eAAe,EACf,SAAS,EACT,MAAM,EACN,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACzB,CAAC;AAGF,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
@@ -4,7 +4,6 @@ export * from './product-features.entity';
4
4
  export * from './solicitor.entity';
5
5
  export * from './broker.entity';
6
6
  export * from './checklist-item.entity';
7
- export * from './company.entity';
8
7
  export * from './application-credit-profile.entity';
9
8
  export * from './application-rationale.entity';
10
9
  export * from './application-product.entity';
@@ -0,0 +1,23 @@
1
+ import { ApplicantEntity } from "../applicants/applicant.entity";
2
+ import { LookupEntity } from "../shared/lookup.entity";
3
+ import { ApplicationCompanyEntity } from "../applications/application-company.entity";
4
+
5
+ export class ApplicantShareholdingEntity {
6
+ id!: string;
7
+ companyId!: string;
8
+ applicantId!: string;
9
+ applicantName!: string;
10
+ directorShareholderLid?: string;
11
+ shareholding?: number;
12
+ createdAt!: Date;
13
+ updatedAt!: Date;
14
+
15
+ // Relations
16
+ company?: ApplicationCompanyEntity;
17
+ applicant?: ApplicantEntity;
18
+ directorShareholder?: LookupEntity;
19
+
20
+ constructor(partial: Partial<ApplicantShareholdingEntity>) {
21
+ Object.assign(this, partial);
22
+ }
23
+ }
@@ -1,17 +1,76 @@
1
- import { ApplicationEntity } from './application.entity';
1
+ import { ApplicantEntity } from "../applicants/applicant.entity";
2
+ import { LookupEntity } from "../shared/lookup.entity";
3
+ import { ApplicationEntity } from "./application.entity";
4
+ import { ApplicantShareholdingEntity } from "../applicants/applicant-share-holding.entity";
2
5
 
3
6
  export class ApplicationCompanyEntity {
4
7
  id!: string;
5
8
  applicationId!: string;
6
- name!: string;
7
- registrationNumber?: string;
9
+ pageValidFlag?: boolean;
10
+ registeredName!: string;
11
+ businessTypeLid!: string;
12
+ registeredNumber!: number;
13
+ taxJurisdictionLid!: string;
14
+ tradingSince!: string;
15
+ natureOfBusiness!: string;
16
+ yearEnd!: string;
17
+ addressPostCode!: string;
18
+ addressLine1!: string;
19
+ addressLine2?: string;
20
+ addressLine3?: string;
21
+ addressCity?: string;
22
+ addressCountryLid!: string;
23
+ yearEnd1!: number;
24
+ turnoverYear1!: number;
25
+ netProfitYear1!: number;
26
+ yearEnd2!: number;
27
+ turnoverYear2!: number;
28
+ netProfitYear2!: number;
29
+ yearEnd3!: number;
30
+ turnoverYear3!: number;
31
+ netProfitYear3!: number;
32
+ companyCreditDefaults!: string;
33
+ companyCountyCourtJudgment!: string;
34
+ companySecuredArrears!: string;
35
+ companyUnsecuredArrears!: string;
36
+ companyBankruptcy!: string;
37
+ companyBankruptcyYes!: boolean;
38
+ companyBankruptcyNo!: boolean;
39
+ companyCCJInLastThreeYearYes!: boolean;
40
+ companyCCJInLastThreeYearNo!: boolean;
41
+ companyDefaultsInLastYearYes!: boolean;
42
+ companyDefaultsInLastYearNo!: boolean;
43
+ companyAnyVoluntaryEnforcedPossessionYes!: boolean;
44
+ companyAnyVoluntaryEnforcedPossessionNo!: boolean;
45
+ doYouKnowRegisteredNumber!: boolean;
46
+ sicCodes!: string[];
47
+ epc!: string;
48
+ remainingLease!: string;
49
+ dateOfIncorporation?: string;
8
50
  createdAt!: Date;
9
51
  updatedAt!: Date;
10
52
 
11
53
  // Relations
12
- application!: ApplicationEntity;
54
+ application?: ApplicationEntity;
55
+ businessType?: LookupEntity;
56
+ taxJurisdiction?: LookupEntity;
57
+ addressCountry?: LookupEntity;
58
+ applicantShareholdings?: ApplicantShareholdingEntity[];
13
59
 
14
60
  constructor(partial: Partial<ApplicationCompanyEntity>) {
15
61
  Object.assign(this, partial);
16
62
  }
17
- }
63
+
64
+ // Virtual fields from Mongoose model
65
+ get businessTypeName(): string | null {
66
+ return this.businessType?.name ?? null;
67
+ }
68
+
69
+ get taxJurisdictionName(): string | null {
70
+ return this.taxJurisdiction?.name ?? null;
71
+ }
72
+
73
+ get addressCountryName(): string | null {
74
+ return this.addressCountry?.name ?? null;
75
+ }
76
+ }
@@ -4,7 +4,6 @@ import type {
4
4
  Solicitor,
5
5
  Broker,
6
6
  ChecklistItem,
7
- Company,
8
7
  ApplicationRationale,
9
8
  ApplicationProduct,
10
9
  ApplicationNote,
@@ -27,7 +26,6 @@ export type {
27
26
  Solicitor,
28
27
  Broker,
29
28
  ChecklistItem,
30
- Company,
31
29
  ApplicationRationale,
32
30
  ApplicationProduct,
33
31
  ApplicationNote,
@@ -49,7 +47,6 @@ export * from './product-features.entity';
49
47
  export * from './solicitor.entity';
50
48
  export * from './broker.entity';
51
49
  export * from './checklist-item.entity';
52
- export * from './company.entity';
53
50
  export * from './application-credit-profile.entity';
54
51
  export * from './application-rationale.entity';
55
52
  export * from './application-product.entity';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.0.46",
3
+ "version": "2.0.47",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,17 @@
1
+ model ApplicantShareholding {
2
+ id String @id @default(uuid())
3
+ companyId String @unique @map("company_id")
4
+ applicantId String @map("applicant_id")
5
+ applicantName String @default("") @map("applicant_name")
6
+ directorShareholderLid String? @map("director_shareholder_lid")
7
+ shareholding Int? @map("shareholding")
8
+ createdAt DateTime @default(now()) @map("created_at")
9
+ updatedAt DateTime @updatedAt @map("updated_at")
10
+
11
+ // Relations
12
+ company ApplicationCompany @relation(fields: [companyId], references: [id])
13
+ applicant Applicant @relation("ApplicantShareholdings", fields: [applicantId], references: [id])
14
+ directorShareholder Lookup? @relation("DirectorShareholder", fields: [directorShareholderLid], references: [id])
15
+
16
+ @@map("applicant_shareholdings")
17
+ }
@@ -1,13 +1,56 @@
1
1
  model ApplicationCompany {
2
- id String @id @default(uuid())
3
- applicationId String @unique @map("application_id")
4
- name String
5
- registrationNumber String? @map("registration_number")
6
- createdAt DateTime @default(now()) @map("created_at")
7
- updatedAt DateTime @updatedAt @map("updated_at")
2
+ id String @id @default(uuid())
3
+ applicationId String @unique @map("application_id")
4
+ pageValidFlag Boolean? @default(true) @map("page_valid_flag")
5
+ registeredName String @map("registered_name")
6
+ businessTypeLid String @map("business_type_lid")
7
+ registeredNumber Int @map("registered_number")
8
+ taxJurisdictionLid String @map("tax_jurisdiction_lid")
9
+ tradingSince String @map("trading_since")
10
+ natureOfBusiness String @default("") @map("nature_of_business")
11
+ yearEnd String @map("year_end")
12
+ addressPostCode String @default("") @map("address_post_code")
13
+ addressLine1 String @map("address_line1")
14
+ addressLine2 String? @map("address_line2")
15
+ addressLine3 String? @map("address_line3")
16
+ addressCity String? @map("address_city")
17
+ addressCountryLid String @map("address_country_lid")
18
+ yearEnd1 Int @map("year_end1")
19
+ turnoverYear1 Decimal @default(0.00) @map("turnover_year1")
20
+ netProfitYear1 Decimal @default(0.00) @map("net_profit_year1")
21
+ yearEnd2 Int @map("year_end2")
22
+ turnoverYear2 Decimal @default(0.00) @map("turnover_year2")
23
+ netProfitYear2 Decimal @default(0.00) @map("net_profit_year2")
24
+ yearEnd3 Int @map("year_end3")
25
+ turnoverYear3 Decimal @default(0.00) @map("turnover_year3")
26
+ netProfitYear3 Decimal @default(0.00) @map("net_profit_year3")
27
+ companyCreditDefaults String @default("") @map("company_credit_defaults")
28
+ companyCountyCourtJudgment String @default("") @map("company_county_court_judgment")
29
+ companySecuredArrears String @default("") @map("company_secured_arrears")
30
+ companyUnsecuredArrears String @default("") @map("company_unsecured_arrears")
31
+ companyBankruptcy String @default("") @map("company_bankruptcy")
32
+ companyBankruptcyYes Boolean @default(false) @map("company_bankruptcy_yes")
33
+ companyBankruptcyNo Boolean @default(true) @map("company_bankruptcy_no")
34
+ companyCCJInLastThreeYearYes Boolean @default(false) @map("company_ccj_in_last_three_year_yes")
35
+ companyCCJInLastThreeYearNo Boolean @default(true) @map("company_ccj_in_last_three_year_no")
36
+ companyDefaultsInLastYearYes Boolean @default(false) @map("company_defaults_in_last_year_yes")
37
+ companyDefaultsInLastYearNo Boolean @default(true) @map("company_defaults_in_last_year_no")
38
+ companyAnyVoluntaryEnforcedPossessionYes Boolean @default(false) @map("company_any_voluntary_enforced_possession_yes")
39
+ companyAnyVoluntaryEnforcedPossessionNo Boolean @default(true) @map("company_any_voluntary_enforced_possession_no")
40
+ doYouKnowRegisteredNumber Boolean @default(true) @map("do_you_know_registered_number")
41
+ sicCodes String[] @map("sic_codes")
42
+ epc String @default("") @map("epc")
43
+ remainingLease String @default("") @map("remaining_lease")
44
+ dateOfIncorporation String? @map("date_of_incorporation")
45
+ createdAt DateTime @default(now()) @map("created_at")
46
+ updatedAt DateTime @updatedAt @map("updated_at")
8
47
 
9
48
  // Relations
10
- application Application @relation("ApplicationCompany", fields: [applicationId], references: [id])
49
+ application Application @relation("ApplicationCompany", fields: [applicationId], references: [id])
50
+ businessType Lookup @relation("BusinessType", fields: [businessTypeLid], references: [id])
51
+ taxJurisdiction Lookup @relation("TaxJurisdiction", fields: [taxJurisdictionLid], references: [id])
52
+ addressCountry Lookup @relation("AddressCountry", fields: [addressCountryLid], references: [id])
53
+ applicantShareholdings ApplicantShareholding[]
11
54
 
12
55
  @@map("application_companies")
13
56
  }
@@ -73,7 +73,6 @@ model Application {
73
73
  audits ApplicationAudit[]
74
74
  underwriters Underwriter[] @relation("ApplicationUnderwriters")
75
75
  products ApplicationProduct[] @relation("ApplicationProducts")
76
- companies Company[] @relation("Company")
77
76
 
78
77
  // Lookup relations
79
78
  applicationType Lookup @relation("ApplicationType", fields: [applicationTypeLid], references: [id])
@@ -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");
@@ -1,89 +1,89 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `accountInArrears` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
5
- - You are about to drop the column `accountInArrearsDetails` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
6
- - You are about to drop the column `accountUptoDate` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
7
- - You are about to drop the column `accountUptoDateFailDetails` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
8
- - You are about to drop the column `commitment_type_lid` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
9
- - You are about to drop the column `doHaveSharedResponsibility` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
10
- - You are about to drop the column `fixedTerm` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
11
- - You are about to drop the column `furtherAdvanceDetails` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
12
- - You are about to drop the column `furtherAdvances` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
13
- - You are about to drop the column `joint_names` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
14
- - You are about to drop the column `originalLoanAmount` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
15
- - You are about to drop the column `sharedMortgage` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
16
- - You are about to drop the column `startDate` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
17
- - You are about to alter the column `property_value` on the `applicant_mortgage_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)`.
18
- - You are about to alter the column `outstanding_balance` on the `applicant_mortgage_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)`.
19
- - You are about to alter the column `monthly_payment` on the `applicant_mortgage_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)`.
20
- - A unique constraint covering the columns `[commitment_id]` on the table `applicant_mortgage_commitments` will be added. If there are existing duplicate values, this will fail.
21
-
22
- */
23
- -- DropForeignKey
24
- ALTER TABLE "applicant_mortgage_commitments" DROP CONSTRAINT "applicant_mortgage_commitments_commitment_type_lid_fkey";
25
-
26
- -- DropForeignKey
27
- ALTER TABLE "applicant_mortgage_commitments" DROP CONSTRAINT "applicant_mortgage_commitments_repayment_type_lid_fkey";
28
-
29
- -- AlterTable
30
- ALTER TABLE "applicant_mortgage_commitments" DROP COLUMN "accountInArrears",
31
- DROP COLUMN "accountInArrearsDetails",
32
- DROP COLUMN "accountUptoDate",
33
- DROP COLUMN "accountUptoDateFailDetails",
34
- DROP COLUMN "commitment_type_lid",
35
- DROP COLUMN "doHaveSharedResponsibility",
36
- DROP COLUMN "fixedTerm",
37
- DROP COLUMN "furtherAdvanceDetails",
38
- DROP COLUMN "furtherAdvances",
39
- DROP COLUMN "joint_names",
40
- DROP COLUMN "originalLoanAmount",
41
- DROP COLUMN "sharedMortgage",
42
- DROP COLUMN "startDate",
43
- ADD COLUMN "account_in_arrears" BOOLEAN,
44
- ADD COLUMN "account_in_arrears_details" TEXT,
45
- ADD COLUMN "account_upto_date" BOOLEAN,
46
- ADD COLUMN "account_upto_date_fail_details" TEXT,
47
- ADD COLUMN "charge_type_lid" TEXT,
48
- ADD COLUMN "do_have_shared_responsibility" BOOLEAN,
49
- ADD COLUMN "finance_home_type_lid" TEXT,
50
- ADD COLUMN "finance_type_hpp_lid" TEXT,
51
- ADD COLUMN "fixed_term" TEXT,
52
- ADD COLUMN "further_advance_details" TEXT,
53
- ADD COLUMN "further_advances" BOOLEAN,
54
- ADD COLUMN "hpp_repayment_type_lid" TEXT,
55
- ADD COLUMN "is_selected" BOOLEAN DEFAULT true,
56
- ADD COLUMN "mortgage_hpp_rationale" TEXT DEFAULT '',
57
- ADD COLUMN "mortgage_rate" DOUBLE PRECISION,
58
- ADD COLUMN "original_loan_amount" DECIMAL(10,2),
59
- ADD COLUMN "purpose" TEXT,
60
- ADD COLUMN "remaining_term" TEXT,
61
- ADD COLUMN "remaining_term_month" INTEGER,
62
- ADD COLUMN "security_details" TEXT,
63
- ADD COLUMN "shared_mortgage" TEXT,
64
- ADD COLUMN "source" TEXT DEFAULT 'Broker',
65
- ADD COLUMN "start_date" TEXT,
66
- ALTER COLUMN "lender_name" DROP NOT NULL,
67
- ALTER COLUMN "property_value" DROP NOT NULL,
68
- ALTER COLUMN "property_value" SET DATA TYPE DECIMAL(10,2),
69
- ALTER COLUMN "repayment_type_lid" DROP NOT NULL,
70
- ALTER COLUMN "outstanding_balance" SET DATA TYPE DECIMAL(10,2),
71
- ALTER COLUMN "monthly_payment" SET DATA TYPE DECIMAL(10,2);
72
-
73
- -- CreateIndex
74
- CREATE UNIQUE INDEX "applicant_mortgage_commitments_commitment_id_key" ON "applicant_mortgage_commitments"("commitment_id");
75
-
76
- -- AddForeignKey
77
- ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_repayment_type_lid_fkey" FOREIGN KEY ("repayment_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
78
-
79
- -- AddForeignKey
80
- ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_finance_type_hpp_lid_fkey" FOREIGN KEY ("finance_type_hpp_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
81
-
82
- -- AddForeignKey
83
- ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_hpp_repayment_type_lid_fkey" FOREIGN KEY ("hpp_repayment_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
84
-
85
- -- AddForeignKey
86
- ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_finance_home_type_lid_fkey" FOREIGN KEY ("finance_home_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
87
-
88
- -- AddForeignKey
89
- ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_charge_type_lid_fkey" FOREIGN KEY ("charge_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `accountInArrears` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
5
+ - You are about to drop the column `accountInArrearsDetails` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
6
+ - You are about to drop the column `accountUptoDate` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
7
+ - You are about to drop the column `accountUptoDateFailDetails` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
8
+ - You are about to drop the column `commitment_type_lid` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
9
+ - You are about to drop the column `doHaveSharedResponsibility` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
10
+ - You are about to drop the column `fixedTerm` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
11
+ - You are about to drop the column `furtherAdvanceDetails` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
12
+ - You are about to drop the column `furtherAdvances` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
13
+ - You are about to drop the column `joint_names` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
14
+ - You are about to drop the column `originalLoanAmount` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
15
+ - You are about to drop the column `sharedMortgage` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
16
+ - You are about to drop the column `startDate` on the `applicant_mortgage_commitments` table. All the data in the column will be lost.
17
+ - You are about to alter the column `property_value` on the `applicant_mortgage_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)`.
18
+ - You are about to alter the column `outstanding_balance` on the `applicant_mortgage_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)`.
19
+ - You are about to alter the column `monthly_payment` on the `applicant_mortgage_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)`.
20
+ - A unique constraint covering the columns `[commitment_id]` on the table `applicant_mortgage_commitments` will be added. If there are existing duplicate values, this will fail.
21
+
22
+ */
23
+ -- DropForeignKey
24
+ ALTER TABLE "applicant_mortgage_commitments" DROP CONSTRAINT "applicant_mortgage_commitments_commitment_type_lid_fkey";
25
+
26
+ -- DropForeignKey
27
+ ALTER TABLE "applicant_mortgage_commitments" DROP CONSTRAINT "applicant_mortgage_commitments_repayment_type_lid_fkey";
28
+
29
+ -- AlterTable
30
+ ALTER TABLE "applicant_mortgage_commitments" DROP COLUMN "accountInArrears",
31
+ DROP COLUMN "accountInArrearsDetails",
32
+ DROP COLUMN "accountUptoDate",
33
+ DROP COLUMN "accountUptoDateFailDetails",
34
+ DROP COLUMN "commitment_type_lid",
35
+ DROP COLUMN "doHaveSharedResponsibility",
36
+ DROP COLUMN "fixedTerm",
37
+ DROP COLUMN "furtherAdvanceDetails",
38
+ DROP COLUMN "furtherAdvances",
39
+ DROP COLUMN "joint_names",
40
+ DROP COLUMN "originalLoanAmount",
41
+ DROP COLUMN "sharedMortgage",
42
+ DROP COLUMN "startDate",
43
+ ADD COLUMN "account_in_arrears" BOOLEAN,
44
+ ADD COLUMN "account_in_arrears_details" TEXT,
45
+ ADD COLUMN "account_upto_date" BOOLEAN,
46
+ ADD COLUMN "account_upto_date_fail_details" TEXT,
47
+ ADD COLUMN "charge_type_lid" TEXT,
48
+ ADD COLUMN "do_have_shared_responsibility" BOOLEAN,
49
+ ADD COLUMN "finance_home_type_lid" TEXT,
50
+ ADD COLUMN "finance_type_hpp_lid" TEXT,
51
+ ADD COLUMN "fixed_term" TEXT,
52
+ ADD COLUMN "further_advance_details" TEXT,
53
+ ADD COLUMN "further_advances" BOOLEAN,
54
+ ADD COLUMN "hpp_repayment_type_lid" TEXT,
55
+ ADD COLUMN "is_selected" BOOLEAN DEFAULT true,
56
+ ADD COLUMN "mortgage_hpp_rationale" TEXT DEFAULT '',
57
+ ADD COLUMN "mortgage_rate" DOUBLE PRECISION,
58
+ ADD COLUMN "original_loan_amount" DECIMAL(10,2),
59
+ ADD COLUMN "purpose" TEXT,
60
+ ADD COLUMN "remaining_term" TEXT,
61
+ ADD COLUMN "remaining_term_month" INTEGER,
62
+ ADD COLUMN "security_details" TEXT,
63
+ ADD COLUMN "shared_mortgage" TEXT,
64
+ ADD COLUMN "source" TEXT DEFAULT 'Broker',
65
+ ADD COLUMN "start_date" TEXT,
66
+ ALTER COLUMN "lender_name" DROP NOT NULL,
67
+ ALTER COLUMN "property_value" DROP NOT NULL,
68
+ ALTER COLUMN "property_value" SET DATA TYPE DECIMAL(10,2),
69
+ ALTER COLUMN "repayment_type_lid" DROP NOT NULL,
70
+ ALTER COLUMN "outstanding_balance" SET DATA TYPE DECIMAL(10,2),
71
+ ALTER COLUMN "monthly_payment" SET DATA TYPE DECIMAL(10,2);
72
+
73
+ -- CreateIndex
74
+ CREATE UNIQUE INDEX "applicant_mortgage_commitments_commitment_id_key" ON "applicant_mortgage_commitments"("commitment_id");
75
+
76
+ -- AddForeignKey
77
+ ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_repayment_type_lid_fkey" FOREIGN KEY ("repayment_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
78
+
79
+ -- AddForeignKey
80
+ ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_finance_type_hpp_lid_fkey" FOREIGN KEY ("finance_type_hpp_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
81
+
82
+ -- AddForeignKey
83
+ ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_hpp_repayment_type_lid_fkey" FOREIGN KEY ("hpp_repayment_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
84
+
85
+ -- AddForeignKey
86
+ ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_finance_home_type_lid_fkey" FOREIGN KEY ("finance_home_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
87
+
88
+ -- AddForeignKey
89
+ ALTER TABLE "applicant_mortgage_commitments" ADD CONSTRAINT "applicant_mortgage_commitments_charge_type_lid_fkey" FOREIGN KEY ("charge_type_lid") REFERENCES "lookups"("id") ON DELETE SET NULL ON UPDATE CASCADE;