gemcap-be-common 1.4.101 → 1.4.102
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/package.json
CHANGED
|
@@ -24,6 +24,7 @@ class LoanStatementStatusService {
|
|
|
24
24
|
let currentDate = (0, dayjs_1.default)(product.startDate).utcOffset(0).startOf('month');
|
|
25
25
|
while (currentDate.diff(endDate, 'month') <= 0) {
|
|
26
26
|
const statementDate = this.getStatementDateForDate(currentDate.toDate());
|
|
27
|
+
console.log('initStatementStatuses');
|
|
27
28
|
await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
28
29
|
currentDate = currentDate.add(1, 'month');
|
|
29
30
|
}
|
|
@@ -68,6 +69,7 @@ class LoanStatementStatusService {
|
|
|
68
69
|
return [{ start: startOfMonth, end: endOfMonth }];
|
|
69
70
|
}
|
|
70
71
|
async toggleStatementLock(productId, statementDate) {
|
|
72
|
+
console.log('toggleStatementLock');
|
|
71
73
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
72
74
|
if (statementStatus) {
|
|
73
75
|
statementStatus.locked = !statementStatus.locked;
|
|
@@ -75,6 +77,7 @@ class LoanStatementStatusService {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
async updateStatementStatus(productId, statementDate, actual) {
|
|
80
|
+
console.log('updateStatementStatus');
|
|
78
81
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
79
82
|
if (statementStatus && !statementStatus.locked) {
|
|
80
83
|
statementStatus.actual = actual;
|
|
@@ -99,6 +102,7 @@ class LoanStatementStatusService {
|
|
|
99
102
|
}
|
|
100
103
|
async getStatementStatus(productId, date) {
|
|
101
104
|
const statementDate = this.getStatementDateForDate(date);
|
|
105
|
+
console.log('getStatementStatus');
|
|
102
106
|
return this.getCreateStatementStatus(productId, statementDate);
|
|
103
107
|
}
|
|
104
108
|
async getCreateStatementStatus(productId, statementDate) {
|
|
@@ -151,6 +155,7 @@ class LoanStatementStatusService {
|
|
|
151
155
|
const loanChargesService = this.getLoanChargesService();
|
|
152
156
|
const products = await loanChargesService.getLoanProducts(borrowerId);
|
|
153
157
|
const lastResults = await Promise.all(products.map(async (product) => {
|
|
158
|
+
console.log('getBorrowerMonthStatus');
|
|
154
159
|
return await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
155
160
|
}));
|
|
156
161
|
return lastResults.reduce((acc, res) => res.actual && acc, true);
|
|
@@ -30,6 +30,7 @@ export class LoanStatementStatusService {
|
|
|
30
30
|
let currentDate = dayjs(product.startDate).utcOffset(0).startOf('month');
|
|
31
31
|
while (currentDate.diff(endDate, 'month') <= 0) {
|
|
32
32
|
const statementDate = this.getStatementDateForDate(currentDate.toDate());
|
|
33
|
+
console.log('initStatementStatuses');
|
|
33
34
|
await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
34
35
|
currentDate = currentDate.add(1, 'month');
|
|
35
36
|
}
|
|
@@ -82,6 +83,7 @@ export class LoanStatementStatusService {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
async toggleStatementLock(productId: string, statementDate: ISelectedMonth) {
|
|
86
|
+
console.log('toggleStatementLock');
|
|
85
87
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
86
88
|
if (statementStatus) {
|
|
87
89
|
statementStatus.locked = !statementStatus.locked;
|
|
@@ -90,6 +92,7 @@ export class LoanStatementStatusService {
|
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
async updateStatementStatus(productId: string, statementDate: ISelectedMonth, actual: boolean) {
|
|
95
|
+
console.log('updateStatementStatus');
|
|
93
96
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
94
97
|
if (statementStatus && !statementStatus.locked) {
|
|
95
98
|
statementStatus.actual = actual;
|
|
@@ -116,6 +119,7 @@ export class LoanStatementStatusService {
|
|
|
116
119
|
|
|
117
120
|
async getStatementStatus(productId: string, date: Date) {
|
|
118
121
|
const statementDate = this.getStatementDateForDate(date);
|
|
122
|
+
console.log('getStatementStatus');
|
|
119
123
|
return this.getCreateStatementStatus(productId, statementDate);
|
|
120
124
|
}
|
|
121
125
|
|
|
@@ -136,7 +140,6 @@ export class LoanStatementStatusService {
|
|
|
136
140
|
await newStatementStatus.save();
|
|
137
141
|
return newStatementStatus;
|
|
138
142
|
}
|
|
139
|
-
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
async validateDate(productId: string, date: Date) {
|
|
@@ -170,6 +173,7 @@ export class LoanStatementStatusService {
|
|
|
170
173
|
const loanChargesService = this.getLoanChargesService();
|
|
171
174
|
const products = await loanChargesService.getLoanProducts(borrowerId);
|
|
172
175
|
const lastResults = await Promise.all(products.map(async (product) => {
|
|
176
|
+
console.log('getBorrowerMonthStatus');
|
|
173
177
|
return await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
174
178
|
}));
|
|
175
179
|
return lastResults.reduce((acc, res) => res.actual && acc, true);
|