@dynamatix/gb-schemas 1.3.208 → 1.3.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/applicants/applicant-additional-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-additional-income.model.js +3 -3
- package/dist/applicants/applicant-commitment-loan.model.d.ts.map +1 -1
- package/dist/applicants/applicant-commitment-loan.model.js +3 -3
- package/dist/applicants/applicant-commitment-mortgage.model.d.ts.map +1 -1
- package/dist/applicants/applicant-commitment-mortgage.model.js +5 -5
- package/dist/applicants/applicant-commitment-residence.model.d.ts.map +1 -1
- package/dist/applicants/applicant-commitment-residence.model.js +5 -5
- package/dist/applicants/applicant-commitment-secureLoan.model.d.ts.map +1 -1
- package/dist/applicants/applicant-commitment-secureLoan.model.js +3 -3
- package/dist/applicants/applicant-commitment-unsecuredLoan.model.d.ts.map +1 -1
- package/dist/applicants/applicant-commitment-unsecuredLoan.model.js +3 -3
- package/dist/applicants/applicant-employment-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-employment-income.model.js +2 -2
- package/dist/applicants/applicant-employment.model.d.ts.map +1 -1
- package/dist/applicants/applicant-employment.model.js +5 -5
- package/dist/applicants/applicant-expenditure.model.d.ts.map +1 -1
- package/dist/applicants/applicant-expenditure.model.js +3 -1
- package/dist/applicants/applicant-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-income.model.js +14 -14
- package/dist/applicants/applicant-pension-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-pension-income.model.js +4 -4
- package/dist/applicants/applicant-property-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-property-income.model.js +7 -7
- package/dist/applicants/applicant-self-employed-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-self-employed-income.model.js +2 -2
- package/dist/applicants/applicant-sole-trader-income.model.d.ts.map +1 -1
- package/dist/applicants/applicant-sole-trader-income.model.js +2 -2
- package/dist/applicants/applicant-uk-tax-credits.model.d.ts.map +1 -1
- package/dist/applicants/applicant-uk-tax-credits.model.js +4 -4
- package/dist/applicants/applicant.model.d.ts.map +1 -1
- package/dist/applicants/applicant.model.js +4 -4
- package/dist/applications/application-company-model.d.ts.map +1 -1
- package/dist/applications/application-company-model.js +9 -8
- package/dist/applications/application-mortgage.model.d.ts.map +1 -1
- package/dist/applications/application-mortgage.model.js +2 -1
- package/dist/applications/application-product.model.d.ts.map +1 -1
- package/dist/applications/application-product.model.js +5 -4
- package/dist/properties/property.model.d.ts.map +1 -1
- package/dist/properties/property.model.js +12 -6
- package/dist/properties/security.model.d.ts.map +1 -1
- package/dist/properties/security.model.js +5 -3
- package/dist/value-objects/pound.d.ts +1 -1
- package/dist/value-objects/pound.d.ts.map +1 -1
- package/dist/value-objects/pound.js +9 -18
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-additional-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-additional-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-additional-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-additional-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgB5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiF,CAAC;AAEtH,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const applicantAdditionalIncomeSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
5
5
|
apprivoSoucrceNumberLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
6
6
|
sourceDetails: { type: String, default: null },
|
|
7
|
-
amount: { type: Pound, default: 0.00 },
|
|
8
|
-
netAmount: { type: Pound, default: 0.00 },
|
|
7
|
+
amount: { type: Pound, default: 0.00, get: formatPound },
|
|
8
|
+
netAmount: { type: Pound, default: 0.00, get: formatPound },
|
|
9
9
|
payFrequencyLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
10
10
|
guaranteed: { type: Boolean, default: false },
|
|
11
11
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-commitment-loan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-loan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-commitment-loan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-loan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAiD5D,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyD,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const loanCommitmentSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
@@ -13,8 +13,8 @@ const loanCommitmentSchema = new mongoose.Schema({
|
|
|
13
13
|
sharedMortgage: { type: String, default: null },
|
|
14
14
|
remainingTerm: { type: String, default: null },
|
|
15
15
|
startDate: { type: String, default: null },
|
|
16
|
-
outstandingBalance: { type: Pound, required: true }, // Balance
|
|
17
|
-
monthlyPayment: { type: Pound, required: true }, // Monthly payment
|
|
16
|
+
outstandingBalance: { type: Pound, required: true, get: formatPound }, // Balance
|
|
17
|
+
monthlyPayment: { type: Pound, required: true, get: formatPound }, // Monthly payment
|
|
18
18
|
source: {
|
|
19
19
|
type: String,
|
|
20
20
|
enum: ["Broker", "Credit Report", "Underwriter"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-commitment-mortgage.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-commitment-mortgage.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAmE5D,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiE,CAAC;AAC/F,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const mortgageCommitmentSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
6
6
|
lenderName: { type: String }, // Provider Name / Provider category
|
|
7
|
-
propertyValue: { type: Pound, default: null },
|
|
7
|
+
propertyValue: { type: Pound, default: null, get: formatPound },
|
|
8
8
|
repaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
9
9
|
mortgageTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
10
10
|
fixedTerm: { type: String, default: null },
|
|
11
|
-
originalLoanAmount: { type: Pound, default: null },
|
|
12
|
-
outstandingBalance: { type: Pound }, // Balance
|
|
11
|
+
originalLoanAmount: { type: Pound, default: null, get: formatPound },
|
|
12
|
+
outstandingBalance: { type: Pound, get: formatPound }, // Balance
|
|
13
13
|
startDate: { type: String, default: null },
|
|
14
|
-
monthlyPayment: { type: Pound }, // Monthly payment
|
|
14
|
+
monthlyPayment: { type: Pound, get: formatPound }, // Monthly payment
|
|
15
15
|
commitmentId: { type: String, default: null },
|
|
16
16
|
commitmentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
17
17
|
furtherAdvances: { type: Boolean, default: false },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-commitment-residence.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-residence.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-commitment-residence.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-residence.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAoD5D,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmE,CAAC;AAClG,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const residenceCommitmentSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
6
6
|
pageValidFlag: { type: Boolean, default: false },
|
|
7
7
|
financeTypeHppLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
8
8
|
lenderName: { type: String, required: true },
|
|
9
|
-
propertyValue: { type: Pound, required: true },
|
|
9
|
+
propertyValue: { type: Pound, required: true, get: formatPound },
|
|
10
10
|
hppRepaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
11
11
|
mortgageTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", default: null },
|
|
12
12
|
fixedTerm: { type: String, required: true },
|
|
13
13
|
commitmentId: { type: String, required: true },
|
|
14
|
-
originalLoanAmount: { type: Pound, required: true },
|
|
15
|
-
outstandingBalance: { type: Pound, required: true },
|
|
14
|
+
originalLoanAmount: { type: Pound, required: true, get: formatPound },
|
|
15
|
+
outstandingBalance: { type: Pound, required: true, get: formatPound },
|
|
16
16
|
startDate: { type: String, required: true },
|
|
17
17
|
mortgageRate: { type: Number, required: true },
|
|
18
18
|
remainingTermMonth: { type: Number, required: true },
|
|
19
19
|
financeHomeTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
20
20
|
chargeTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
21
|
-
monthlyPayment: { type: Pound, required: true },
|
|
21
|
+
monthlyPayment: { type: Pound, required: true, get: formatPound },
|
|
22
22
|
furtherAdvances: {
|
|
23
23
|
type: Boolean,
|
|
24
24
|
required: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-commitment-secureLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-secureLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-commitment-secureLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-secureLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAuC5D,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAuE,CAAC;AACxG,eAAe,0BAA0B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const securedLoanCommitmentSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
@@ -11,8 +11,8 @@ const securedLoanCommitmentSchema = new mongoose.Schema({
|
|
|
11
11
|
sharedMortgage: { type: String, default: null },
|
|
12
12
|
remainingTerm: { type: Number, default: null }, // Remaining term
|
|
13
13
|
startDate: { type: String, default: null },
|
|
14
|
-
outstandingBalance: { type: Pound, required: true }, // Balance
|
|
15
|
-
monthlyPayment: { type: Pound, required: true }, // Monthly payment
|
|
14
|
+
outstandingBalance: { type: Pound, required: true, get: formatPound }, // Balance
|
|
15
|
+
monthlyPayment: { type: Pound, required: true, get: formatPound }, // Monthly payment
|
|
16
16
|
source: {
|
|
17
17
|
type: String,
|
|
18
18
|
enum: ["Broker", "Credit Report", "Underwriter"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-commitment-unsecuredLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-unsecuredLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-commitment-unsecuredLoan.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-commitment-unsecuredLoan.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAuC5D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2E,CAAC;AAC9G,eAAe,4BAA4B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const unsecuredLoanCommitmentSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
@@ -10,8 +10,8 @@ const unsecuredLoanCommitmentSchema = new mongoose.Schema({
|
|
|
10
10
|
sharedMortgage: { type: String, default: null },
|
|
11
11
|
remainingTerm: { type: Number, default: null }, // Remaining term
|
|
12
12
|
startDate: { type: String, default: null },
|
|
13
|
-
outstandingBalance: { type: Pound, required: true }, // Balance
|
|
14
|
-
monthlyPayment: { type: Pound, required: true }, // Monthly payment
|
|
13
|
+
outstandingBalance: { type: Pound, required: true, get: formatPound }, // Balance
|
|
14
|
+
monthlyPayment: { type: Pound, required: true, get: formatPound }, // Monthly payment
|
|
15
15
|
source: {
|
|
16
16
|
type: String,
|
|
17
17
|
enum: ["Broker", "Credit Report", "Underwriter"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-employment-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-employment-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-employment-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-employment-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAa5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAgF,CAAC;AAErH,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const applicantEmploymentIncomeSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
5
5
|
incomeTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
6
|
-
amount: { type: Pound, required: true },
|
|
6
|
+
amount: { type: Pound, required: true, get: formatPound },
|
|
7
7
|
});
|
|
8
8
|
applicantEmploymentIncomeSchema.virtual('incomeSourceId').get(function () {
|
|
9
9
|
return this.applicantId?.incomeSourceId instanceof mongoose.Types.ObjectId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-employment.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-employment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-employment.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-employment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA2C5D,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAgF,CAAC;AAE1G,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const applicantEmploymentSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
5
5
|
acceptableIncomeLids: [{ type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }],
|
|
@@ -11,22 +11,22 @@ const applicantEmploymentSchema = new mongoose.Schema({
|
|
|
11
11
|
addressPostCode: { type: String, required: true },
|
|
12
12
|
contractRemaining: { type: String },
|
|
13
13
|
dateJoined: { type: String, required: true },
|
|
14
|
-
disabilityLiving: { type: Pound, default: 0.00 },
|
|
14
|
+
disabilityLiving: { type: Pound, default: 0.00, get: formatPound },
|
|
15
15
|
employerName: { type: String, required: true },
|
|
16
16
|
employerTelephone: { type: String, default: null },
|
|
17
|
-
housingAllowance: { type: Pound, default: 0.00 },
|
|
17
|
+
housingAllowance: { type: Pound, default: 0.00, get: formatPound },
|
|
18
18
|
industryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
19
19
|
isUnderTerminationNotice: { type: Boolean, default: false },
|
|
20
20
|
jobTitleLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
21
21
|
natureOfBusiness: { type: String, required: true },
|
|
22
|
-
pensionIncome: { type: Pound, default: 0.00 },
|
|
22
|
+
pensionIncome: { type: Pound, default: 0.00, get: formatPound },
|
|
23
23
|
previousAddressCity: { type: String, default: null },
|
|
24
24
|
previousAddressCountryLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
25
25
|
previousAddressLine1: { type: String, required: true },
|
|
26
26
|
previousAddressLine2: { type: String, default: null },
|
|
27
27
|
previousAddressLine3: { type: String, default: null },
|
|
28
28
|
previousAddressPostCode: { type: String, required: true },
|
|
29
|
-
previousBasicGrossIncome: { type: Pound, default: 0.00, required: true },
|
|
29
|
+
previousBasicGrossIncome: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
30
30
|
previousDateJoined: { type: String, required: true },
|
|
31
31
|
previousDateLeft: { type: String, required: true },
|
|
32
32
|
previousEmployerName: { type: String, required: true },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-expenditure.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-expenditure.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-expenditure.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-expenditure.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA8E5D,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAsE,CAAC;AACtG,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const applicantExpenditureSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: {
|
|
@@ -30,6 +30,7 @@ const applicantExpenditureSchema = new mongoose.Schema({
|
|
|
30
30
|
declared: {
|
|
31
31
|
type: Pound,
|
|
32
32
|
description: "Declared monthly expenditure amount provided by the applicant.",
|
|
33
|
+
get: formatPound
|
|
33
34
|
},
|
|
34
35
|
expected: {
|
|
35
36
|
type: String,
|
|
@@ -38,6 +39,7 @@ const applicantExpenditureSchema = new mongoose.Schema({
|
|
|
38
39
|
actual: {
|
|
39
40
|
type: Pound,
|
|
40
41
|
description: "Actual monthly expenditure verified based on applicant's evidence.",
|
|
42
|
+
get: formatPound
|
|
41
43
|
},
|
|
42
44
|
rationale: {
|
|
43
45
|
type: String,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAkF5D,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmD,CAAC;AAE9E,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
4
4
|
const incomeSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
@@ -34,9 +34,9 @@ const incomeSchema = new mongoose.Schema({
|
|
|
34
34
|
},
|
|
35
35
|
nameOfBusiness: { type: String, },
|
|
36
36
|
natureOfBusiness: { type: String, },
|
|
37
|
-
netAssets1: { type: Pound, default: 0.00 },
|
|
38
|
-
netAssets2: { type: Pound, default: 0.00 },
|
|
39
|
-
netAssets3: { type: Pound, default: 0.00 },
|
|
37
|
+
netAssets1: { type: Pound, default: 0.00, get: formatPound },
|
|
38
|
+
netAssets2: { type: Pound, default: 0.00, get: formatPound },
|
|
39
|
+
netAssets3: { type: Pound, default: 0.00, get: formatPound },
|
|
40
40
|
pageValidFlag: { type: String, default: true },
|
|
41
41
|
percentageOfShareholding: { type: Number, min: 0, max: 100 },
|
|
42
42
|
registeredAddressLine1: { type: String, },
|
|
@@ -53,26 +53,26 @@ const incomeSchema = new mongoose.Schema({
|
|
|
53
53
|
employmentIncomeRationale: { type: String, default: null },
|
|
54
54
|
isPensionIncomeConfirmed: { type: Boolean, default: false },
|
|
55
55
|
pensionIncomeRationale: { type: String, default: null },
|
|
56
|
-
totalPensionGrossIncome: { type: Pound, default: 0.00 },
|
|
57
|
-
totalPensionNetIncome: { type: Pound, default: 0.00 },
|
|
58
|
-
totalAdditionalGrossIncome: { type: Pound, default: 0.00 },
|
|
59
|
-
totalAdditionalNetIncome: { type: Pound, default: 0.00 },
|
|
56
|
+
totalPensionGrossIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
57
|
+
totalPensionNetIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
58
|
+
totalAdditionalGrossIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
59
|
+
totalAdditionalNetIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
60
60
|
isAdditionalIncomeConfirmed: { type: Boolean, default: false },
|
|
61
61
|
additionalIncomeRationale: { type: String, default: null },
|
|
62
62
|
isUKTaxCreditsIncomeConfirmed: { type: Boolean, default: false },
|
|
63
|
-
totalUKTaxCreditsGrossIncome: { type: Pound, default: 0.00 },
|
|
64
|
-
totalUKTaxCreditsNetIncome: { type: Pound, default: 0.00 },
|
|
63
|
+
totalUKTaxCreditsGrossIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
64
|
+
totalUKTaxCreditsNetIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
65
65
|
ukTaxCreditsIncomeRationale: { type: String, default: null },
|
|
66
66
|
isPropertyIncomeConfirmed: { type: Boolean, default: false },
|
|
67
67
|
propertyIncomeRationale: { type: String, default: null },
|
|
68
68
|
selfEmployedIncomeRationale: { type: String, default: null },
|
|
69
69
|
isSelfEmployedIncomeConfirmed: { type: Boolean, default: false },
|
|
70
|
-
totalSelfEmployedGrossIncome: { type: Pound, default: 0.00 },
|
|
71
|
-
totalSelfEmployedNetIncome: { type: Pound, default: 0.00 },
|
|
70
|
+
totalSelfEmployedGrossIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
71
|
+
totalSelfEmployedNetIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
72
72
|
soleTraderIncomeRationale: { type: String, default: null },
|
|
73
73
|
isSoleTraderIncomeConfirmed: { type: Boolean, default: false },
|
|
74
|
-
soleTraderGrossIncome: { type: Pound, default: 0.00 },
|
|
75
|
-
soleTraderNetIncome: { type: Pound, default: 0.00 },
|
|
74
|
+
soleTraderGrossIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
75
|
+
soleTraderNetIncome: { type: Pound, get: formatPound, default: 0.00 },
|
|
76
76
|
}, {
|
|
77
77
|
toJSON: { getters: true },
|
|
78
78
|
toObject: { getters: true }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-pension-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-pension-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-pension-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-pension-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgC5D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0E,CAAC;AAE7G,eAAe,4BAA4B,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const applicantPensionIncomSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: {
|
|
5
5
|
type: mongoose.Schema.Types.ObjectId,
|
|
6
6
|
ref: "Applicant",
|
|
7
7
|
required: true
|
|
8
8
|
},
|
|
9
|
-
monthlyPrivatePension: { type: Pound, default: 0.00, required: true },
|
|
10
|
-
monthlyStatePension: { type: Pound, default: 0.00, required: true },
|
|
11
|
-
monthlyPensionIncome: { type: Pound, default: 0.00, required: true },
|
|
9
|
+
monthlyPrivatePension: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
10
|
+
monthlyStatePension: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
11
|
+
monthlyPensionIncome: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
12
12
|
});
|
|
13
13
|
applicantPensionIncomSchema.virtual('applicationType').get(function () {
|
|
14
14
|
return this.applicantId?.applicationTypeLid instanceof mongoose.Types.ObjectId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-property-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-property-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-property-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-property-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA6B5D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAoE,CAAC;AAEvG,eAAe,4BAA4B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const propertyIncomeSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: {
|
|
5
5
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -8,16 +8,16 @@ const propertyIncomeSchema = new mongoose.Schema({
|
|
|
8
8
|
},
|
|
9
9
|
// Latest tax year
|
|
10
10
|
yearEnd1: { type: Number, required: true },
|
|
11
|
-
rentalIncome1: { type: Pound, required: true },
|
|
12
|
-
netProfit1: { type: Pound, required: true },
|
|
11
|
+
rentalIncome1: { type: Pound, required: true, get: formatPound },
|
|
12
|
+
netProfit1: { type: Pound, required: true, get: formatPound },
|
|
13
13
|
// Previous tax year
|
|
14
14
|
yearEnd2: { type: Number, required: true },
|
|
15
|
-
rentalIncome2: { type: Pound, required: true },
|
|
16
|
-
netProfit2: { type: Pound, required: true },
|
|
15
|
+
rentalIncome2: { type: Pound, required: true, get: formatPound },
|
|
16
|
+
netProfit2: { type: Pound, required: true, get: formatPound },
|
|
17
17
|
// Previous tax year
|
|
18
18
|
yearEnd3: { type: Number, required: true },
|
|
19
|
-
rentalIncome3: { type: Pound, required: true },
|
|
20
|
-
netProfit3: { type: Pound, required: true }
|
|
19
|
+
rentalIncome3: { type: Pound, required: true, get: formatPound },
|
|
20
|
+
netProfit3: { type: Pound, required: true, get: formatPound }
|
|
21
21
|
});
|
|
22
22
|
propertyIncomeSchema.virtual('incomeSourceId').get(function () {
|
|
23
23
|
return this.applicantId?.incomeSourceId instanceof mongoose.Types.ObjectId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-self-employed-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-self-employed-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-self-employed-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-self-employed-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAgB5D,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6E,CAAC;AAEpH,eAAe,gCAAgC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const selfEmployedIncomeSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
5
5
|
incomeSourceLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
6
|
-
amount: { type: Pound, default: 0.00, required: true },
|
|
6
|
+
amount: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
7
7
|
}, {
|
|
8
8
|
toJSON: { getters: true },
|
|
9
9
|
toObject: { getters: true }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-sole-trader-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-sole-trader-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-sole-trader-income.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-sole-trader-income.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAiB5D,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyE,CAAC;AAE9G,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const soleTraderIncomeSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
5
5
|
incomeSourceLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true },
|
|
6
|
-
amount: { type: Pound, default: 0.00 },
|
|
6
|
+
amount: { type: Pound, default: 0.00, get: formatPound },
|
|
7
7
|
}, {
|
|
8
8
|
toJSON: { getters: true },
|
|
9
9
|
toObject: { getters: true }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant-uk-tax-credits.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-uk-tax-credits.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant-uk-tax-credits.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-uk-tax-credits.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAe5D,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0E,CAAC;AAE3G,eAAe,0BAA0B,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const applicantUkTaxCreditsSchema = new mongoose.Schema({
|
|
4
4
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true },
|
|
5
|
-
taxCredits: { type: Pound, default: 0.00 },
|
|
6
|
-
maintenance: { type: Pound, default: 0.00 },
|
|
7
|
-
otherBenefits: { type: Pound, default: 0.00 },
|
|
5
|
+
taxCredits: { type: Pound, default: 0.00, get: formatPound },
|
|
6
|
+
maintenance: { type: Pound, default: 0.00, get: formatPound },
|
|
7
|
+
otherBenefits: { type: Pound, default: 0.00, get: formatPound },
|
|
8
8
|
otherBenefitsExplanation: { type: String, default: null },
|
|
9
9
|
});
|
|
10
10
|
applicantUkTaxCreditsSchema.virtual('incomeSourceId').get(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicant.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAOhC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"applicant.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAOhC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA4P5D,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA+C,CAAC;AACpE,eAAe,cAAc,CAAC"}
|
|
@@ -3,7 +3,7 @@ import applicantCreditDataSchema from "./applicant-credit-data.model";
|
|
|
3
3
|
import applicantRiskNarrativeSchema from "./applicant-risk-narrative.model";
|
|
4
4
|
import applicantDirectDebitSchema from "./applicant-direct-debit.model";
|
|
5
5
|
import creditProfileSchema from "./applicant-credit-profile.model";
|
|
6
|
-
import { Pound } from "../value-objects/pound";
|
|
6
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
7
7
|
import { applyAuditMiddleware } from "@dynamatix/cat-shared/middlewares";
|
|
8
8
|
const applicantSchema = new mongoose.Schema({
|
|
9
9
|
applicantId: { type: String, required: true },
|
|
@@ -159,9 +159,9 @@ const applicantSchema = new mongoose.Schema({
|
|
|
159
159
|
return this.isUkResident;
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
|
-
proposedFinanceAmount: { type: Pound, default: 0, description: "Proposed finance amount for fixed expenditures, defaults to 0.", },
|
|
163
|
-
topupAmount: { type: Pound, default: 0, description: "Top-up amount for fixed expenditures, defaults to 0.", },
|
|
164
|
-
creditCommitments: { type: Pound, default: 0, description: "Total credit commitments amount, defaults to 0.", },
|
|
162
|
+
proposedFinanceAmount: { type: Pound, default: 0, description: "Proposed finance amount for fixed expenditures, defaults to 0.", get: formatPound },
|
|
163
|
+
topupAmount: { type: Pound, default: 0, description: "Top-up amount for fixed expenditures, defaults to 0.", get: formatPound },
|
|
164
|
+
creditCommitments: { type: Pound, default: 0, description: "Total credit commitments amount, defaults to 0.", get: formatPound },
|
|
165
165
|
creditData: applicantCreditDataSchema,
|
|
166
166
|
riskNarrative: applicantRiskNarrativeSchema,
|
|
167
167
|
incomeSourceId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant_IncomeSettings", default: null },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-company-model.d.ts","sourceRoot":"","sources":["../../applications/application-company-model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"application-company-model.d.ts","sourceRoot":"","sources":["../../applications/application-company-model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,0BAA0B,CAAA;AA6I7D,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAsD,CAAC;AACpF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "./../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "./../value-objects/pound";
|
|
3
3
|
import { AccountNumber } from "../value-objects/account-number";
|
|
4
4
|
const ApplicantShareholdingSchema = new mongoose.Schema({
|
|
5
5
|
applicantId: { type: mongoose.Schema.Types.ObjectId, ref: "Applicant", required: true, default: null },
|
|
@@ -8,7 +8,8 @@ const ApplicantShareholdingSchema = new mongoose.Schema({
|
|
|
8
8
|
shareholding: { type: Number, min: 0, max: 100, default: null }
|
|
9
9
|
}, { _id: false });
|
|
10
10
|
const companySchema = new mongoose.Schema({
|
|
11
|
-
applicationId: {
|
|
11
|
+
applicationId: {
|
|
12
|
+
type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
|
|
12
13
|
description: "Unique identifier for the application"
|
|
13
14
|
},
|
|
14
15
|
pageValidFlag: { type: Boolean, default: true, },
|
|
@@ -28,14 +29,14 @@ const companySchema = new mongoose.Schema({
|
|
|
28
29
|
applicationTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup", required: true }, // form
|
|
29
30
|
applicantShareholding: [ApplicantShareholdingSchema], // form
|
|
30
31
|
yearEnd1: { type: Number, required: true, max: 9999 }, // form
|
|
31
|
-
turnoverYear1: { type: Pound, required: true, default: 0.00 }, // form
|
|
32
|
-
netProfitYear1: { type: Pound, required: true, default: 0.00 }, // form
|
|
32
|
+
turnoverYear1: { type: Pound, required: true, default: 0.00, get: formatPound }, // form
|
|
33
|
+
netProfitYear1: { type: Pound, required: true, default: 0.00, get: formatPound }, // form
|
|
33
34
|
yearEnd2: { type: Number, required: true, max: 9999 }, // form
|
|
34
|
-
turnoverYear2: { type: Pound, required: true, default: 0.00 }, // form
|
|
35
|
-
netProfitYear2: { type: Pound, required: true, default: 0.00 }, // form
|
|
35
|
+
turnoverYear2: { type: Pound, required: true, default: 0.00, get: formatPound }, // form
|
|
36
|
+
netProfitYear2: { type: Pound, required: true, default: 0.00, get: formatPound }, // form
|
|
36
37
|
yearEnd3: { type: Number, required: true, max: 9999 }, // form
|
|
37
|
-
turnoverYear3: { type: Pound, required: true, default: 0.00 }, // form
|
|
38
|
-
netProfitYear3: { type: Pound, required: true, default: 0.00 }, // form
|
|
38
|
+
turnoverYear3: { type: Pound, required: true, default: 0.00, get: formatPound }, // form
|
|
39
|
+
netProfitYear3: { type: Pound, required: true, default: 0.00, get: formatPound }, // form
|
|
39
40
|
// Purchase form - Company section
|
|
40
41
|
companyCreditDefaults: { type: String, required: true, default: '' }, // form
|
|
41
42
|
companyCountyCourtJudgment: { type: String, required: true, default: '' }, // form
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-mortgage.model.d.ts","sourceRoot":"","sources":["../../applications/application-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"application-mortgage.model.d.ts","sourceRoot":"","sources":["../../applications/application-mortgage.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AAkS5D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AAEjE,eAAe,aAAa,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const mortgageSchema = new mongoose.Schema({
|
|
4
4
|
applicationId: {
|
|
5
5
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -46,6 +46,7 @@ const mortgageSchema = new mongoose.Schema({
|
|
|
46
46
|
purchasePrice: {
|
|
47
47
|
type: Pound,
|
|
48
48
|
description: "Purchase price of the property",
|
|
49
|
+
get: formatPound
|
|
49
50
|
},
|
|
50
51
|
repaymentTypeLid: {
|
|
51
52
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-product.model.d.ts","sourceRoot":"","sources":["../../applications/application-product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"application-product.model.d.ts","sourceRoot":"","sources":["../../applications/application-product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA0EhC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2C,CAAC;AAC9D,eAAe,YAAY,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
|
-
import { Pound } from "../value-objects/pound";
|
|
2
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
3
3
|
const productSchema = new mongoose.Schema({
|
|
4
|
-
applicationId: {
|
|
4
|
+
applicationId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
|
|
5
6
|
description: "Unique identifier for the application"
|
|
6
7
|
},
|
|
7
8
|
selectedProduct: { type: String, default: "" },
|
|
@@ -10,7 +11,7 @@ const productSchema = new mongoose.Schema({
|
|
|
10
11
|
repaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
|
|
11
12
|
numberOfYearsToRepay: { type: Number, default: 0 },
|
|
12
13
|
repaymentVehicle: { type: String, required: true, default: '', maxLength: 100 },
|
|
13
|
-
fixedAmount: { type: Pound, default: 0.00, required: false },
|
|
14
|
+
fixedAmount: { type: Pound, default: 0.00, required: false, get: formatPound },
|
|
14
15
|
isFinanceRecommendedToApplicantLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
|
|
15
16
|
procFeeRateLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" },
|
|
16
17
|
networkClubSubmission: { type: Boolean, required: true, get: (value) => (value ? "Yes" : "No") },
|
|
@@ -18,7 +19,7 @@ const productSchema = new mongoose.Schema({
|
|
|
18
19
|
introducerSubmission: { type: Boolean, required: true, get: (value) => (value ? "Yes" : "No") },
|
|
19
20
|
introducer: { type: String, default: '' },
|
|
20
21
|
bdm: { type: String, required: true, default: '' },
|
|
21
|
-
tempAppFee: { type: Pound, default: 0.00, required: true },
|
|
22
|
+
tempAppFee: { type: Pound, default: 0.00, required: true, get: formatPound },
|
|
22
23
|
productFeePaymentTypeLid: { type: mongoose.Schema.Types.ObjectId, ref: "Lookup" }
|
|
23
24
|
});
|
|
24
25
|
// virtual property 'lendingType'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.model.d.ts","sourceRoot":"","sources":["../../properties/property.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"property.model.d.ts","sourceRoot":"","sources":["../../properties/property.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAe,MAAM,wBAAwB,CAAC;AA0J5D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACjE,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
-
import { Pound } from '../value-objects/pound';
|
|
2
|
+
import { Pound, formatPound } from '../value-objects/pound';
|
|
3
3
|
const propertySchema = new mongoose.Schema({
|
|
4
|
-
applicationId: {
|
|
4
|
+
applicationId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId, ref: "Application",
|
|
5
6
|
description: "Unique identifier for the application",
|
|
6
7
|
required: true
|
|
7
8
|
},
|
|
@@ -62,30 +63,35 @@ const propertySchema = new mongoose.Schema({
|
|
|
62
63
|
required: true,
|
|
63
64
|
default: 0.00,
|
|
64
65
|
description: "The market value of the property",
|
|
66
|
+
get: formatPound
|
|
65
67
|
},
|
|
66
68
|
monthlyRent: {
|
|
67
69
|
type: Pound,
|
|
68
70
|
required: true,
|
|
69
71
|
default: 0.00,
|
|
70
|
-
description: "The monthly rent value of the property"
|
|
72
|
+
description: "The monthly rent value of the property",
|
|
73
|
+
get: formatPound
|
|
71
74
|
},
|
|
72
75
|
monthlyRepayment: {
|
|
73
76
|
type: Pound,
|
|
74
77
|
required: true,
|
|
75
78
|
default: 0.00,
|
|
76
|
-
description: "The monthly repayment value for the property"
|
|
79
|
+
description: "The monthly repayment value for the property",
|
|
80
|
+
get: formatPound
|
|
77
81
|
},
|
|
78
82
|
originalLoanBalance: {
|
|
79
83
|
type: Pound,
|
|
80
84
|
required: true,
|
|
81
85
|
default: 0.00,
|
|
82
|
-
description: "The original loan balance for the property"
|
|
86
|
+
description: "The original loan balance for the property",
|
|
87
|
+
get: formatPound
|
|
83
88
|
},
|
|
84
89
|
outstandingBalance: {
|
|
85
90
|
type: Pound,
|
|
86
91
|
required: true,
|
|
87
92
|
default: 0.00,
|
|
88
|
-
description: "The remaining outstanding balance of the property loan"
|
|
93
|
+
description: "The remaining outstanding balance of the property loan",
|
|
94
|
+
get: formatPound
|
|
89
95
|
},
|
|
90
96
|
otherOwnershipParties: {
|
|
91
97
|
type: String,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.model.d.ts","sourceRoot":"","sources":["../../properties/security.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,QAAQ,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"security.model.d.ts","sourceRoot":"","sources":["../../properties/security.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,QAAQ,MAAM,UAAU,CAAC;AA4JhC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACjE,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// security.model.ts
|
|
2
2
|
import mongoose from "mongoose";
|
|
3
|
-
import { Pound } from "../value-objects/pound";
|
|
3
|
+
import { Pound, formatPound } from "../value-objects/pound";
|
|
4
4
|
const dataStreetSchema = new mongoose.Schema({
|
|
5
5
|
floorArea: { type: String, default: '' },
|
|
6
6
|
propertyType: { type: String, default: '' },
|
|
@@ -51,7 +51,8 @@ const dataStreetSchema = new mongoose.Schema({
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
const securitySchema = new mongoose.Schema({
|
|
54
|
-
applicationId: {
|
|
54
|
+
applicationId: {
|
|
55
|
+
type: mongoose.Schema.Types.ObjectId, ref: "Application", required: true,
|
|
55
56
|
description: "Unique identifier for the application"
|
|
56
57
|
}, // not-form securityData
|
|
57
58
|
pageValidFlag: { type: Boolean, default: true, }, //form
|
|
@@ -98,7 +99,8 @@ const securitySchema = new mongoose.Schema({
|
|
|
98
99
|
serviceCharge: {
|
|
99
100
|
type: Pound,
|
|
100
101
|
required: true,
|
|
101
|
-
default: 0.00 // Default value in correct format
|
|
102
|
+
default: 0.00, // Default value in correct format
|
|
103
|
+
get: formatPound
|
|
102
104
|
}, // form - pounds
|
|
103
105
|
unexpiredRemainingLease: { type: Number, required: true, max: 9999, default: 0 }, // form
|
|
104
106
|
yearLeaseExpires: { type: Number, required: true, default: 0 }, // not-form securityData
|
|
@@ -37,7 +37,7 @@ declare module 'mongoose' {
|
|
|
37
37
|
declare class Pound extends mongoose.SchemaType {
|
|
38
38
|
constructor(key: string, options: mongoose.AnyObject | undefined);
|
|
39
39
|
cast(val: any): any;
|
|
40
|
-
get(val: any): any;
|
|
41
40
|
}
|
|
41
|
+
export declare function formatPound(val: any): string | null;
|
|
42
42
|
export { Pound };
|
|
43
43
|
//# sourceMappingURL=pound.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pound.d.ts","sourceRoot":"","sources":["../../value-objects/pound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,OAAO,QAAQ,UAAU,CAAC;IACtB,UAAU,MAAM,CAAC;QACb,UAAU,KAAK,CAAC;YACZ,MAAM,KAAM,SAAQ,UAAU;aAAI;SACrC;KACJ;CACJ;AAED,cAAM,KAAM,SAAQ,QAAQ,CAAC,UAAU;gBACvB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,SAAS;IAKhE,IAAI,CAAC,GAAG,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"pound.d.ts","sourceRoot":"","sources":["../../value-objects/pound.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,OAAO,QAAQ,UAAU,CAAC;IACtB,UAAU,MAAM,CAAC;QACb,UAAU,KAAK,CAAC;YACZ,MAAM,KAAM,SAAQ,UAAU;aAAI;SACrC;KACJ;CACJ;AAED,cAAM,KAAM,SAAQ,QAAQ,CAAC,UAAU;gBACvB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,SAAS;IAKhE,IAAI,CAAC,GAAG,EAAE,GAAG;CA6ChB;AAMD,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAKnD;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -30,25 +30,16 @@ class Pound extends mongoose.SchemaType {
|
|
|
30
30
|
}
|
|
31
31
|
throw new mongoose.Error.CastError('Pound', val, this.path, new Error('Pound value must be a string or number'));
|
|
32
32
|
}
|
|
33
|
-
// Custom getter to format the value when retrieving
|
|
34
|
-
get(val) {
|
|
35
|
-
if (val == null) {
|
|
36
|
-
return val;
|
|
37
|
-
}
|
|
38
|
-
// Ensure we have a number
|
|
39
|
-
const numValue = typeof val === 'number' ? val : parseFloat(val);
|
|
40
|
-
if (isNaN(numValue)) {
|
|
41
|
-
return val; // Return original value if parsing fails
|
|
42
|
-
}
|
|
43
|
-
// Format as UK currency with pound sign, commas, and 2 decimal places
|
|
44
|
-
return new Intl.NumberFormat('en-GB', {
|
|
45
|
-
style: 'currency',
|
|
46
|
-
currency: 'GBP',
|
|
47
|
-
minimumFractionDigits: 2,
|
|
48
|
-
maximumFractionDigits: 2
|
|
49
|
-
}).format(numValue);
|
|
50
|
-
}
|
|
51
33
|
}
|
|
52
34
|
// Register custom type
|
|
53
35
|
mongoose.Schema.Types.Pound = Pound;
|
|
36
|
+
// Common function to format value as UK pound string
|
|
37
|
+
export function formatPound(val) {
|
|
38
|
+
if (val == null || val === '')
|
|
39
|
+
return '£0.00';
|
|
40
|
+
let num = typeof val === 'string' ? Number(val) : val;
|
|
41
|
+
if (typeof num !== 'number' || isNaN(num) || !isFinite(num))
|
|
42
|
+
return '£0.00';
|
|
43
|
+
return '£' + num.toLocaleString('en-GB', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
44
|
+
}
|
|
54
45
|
export { Pound };
|