gemcap-be-common 1.3.1 → 1.3.2
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
|
@@ -35,11 +35,11 @@ export declare const borrowerDataModels: {
|
|
|
35
35
|
[modelName: string]: mongoose.Model<any>;
|
|
36
36
|
};
|
|
37
37
|
export declare class BorrowerService {
|
|
38
|
-
private readonly
|
|
39
|
-
private readonly
|
|
40
|
-
private readonly
|
|
41
|
-
private readonly
|
|
42
|
-
constructor(
|
|
38
|
+
private readonly getCollateralsService;
|
|
39
|
+
private readonly getLoanStatementStatusService;
|
|
40
|
+
private readonly getLoanTransactionsService;
|
|
41
|
+
private readonly getSignsService;
|
|
42
|
+
constructor(getCollateralsService: () => CollateralsService, getLoanStatementStatusService: () => LoanStatementStatusService, getLoanTransactionsService: () => LoanTransactionsService, getSignsService: () => SignsService);
|
|
43
43
|
isBorrowerAllowed(userAccess: any, requestedBorrowerId: string): boolean;
|
|
44
44
|
checkBorrower(userAccess: any, requestedBorrowerId: string): boolean;
|
|
45
45
|
getBorrowerById(borrowerId: string): Promise<mongoose.FlattenMaps<IBorrowerDocument> & {
|
|
@@ -29,15 +29,15 @@ exports.borrowerDataModels = {
|
|
|
29
29
|
insurance: BorrowerDataInsurance_model_1.BorrowerDataInsuranceModel,
|
|
30
30
|
};
|
|
31
31
|
class BorrowerService {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
constructor(
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
32
|
+
getCollateralsService;
|
|
33
|
+
getLoanStatementStatusService;
|
|
34
|
+
getLoanTransactionsService;
|
|
35
|
+
getSignsService;
|
|
36
|
+
constructor(getCollateralsService, getLoanStatementStatusService, getLoanTransactionsService, getSignsService) {
|
|
37
|
+
this.getCollateralsService = getCollateralsService;
|
|
38
|
+
this.getLoanStatementStatusService = getLoanStatementStatusService;
|
|
39
|
+
this.getLoanTransactionsService = getLoanTransactionsService;
|
|
40
|
+
this.getSignsService = getSignsService;
|
|
41
41
|
}
|
|
42
42
|
isBorrowerAllowed(userAccess, requestedBorrowerId) {
|
|
43
43
|
if (userAccess.allBorrowers) {
|
|
@@ -158,9 +158,12 @@ class BorrowerService {
|
|
|
158
158
|
return Borrower_model_1.BorrowerModel.findOne({ code });
|
|
159
159
|
}
|
|
160
160
|
async getExtraInfo(borrowerId) {
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
const
|
|
161
|
+
const loanTransactionsService = this.getLoanTransactionsService();
|
|
162
|
+
const collateralsService = this.getCollateralsService();
|
|
163
|
+
const signsService = this.getSignsService();
|
|
164
|
+
const extraInfo = await loanTransactionsService.getLoanBalanceForBorrowerId(borrowerId);
|
|
165
|
+
const { lastBBCDate, lastBBCId } = await collateralsService.getLatestBBCDate(borrowerId);
|
|
166
|
+
const lastSignedBBCDate = await signsService.getLatestSignedBBCDate(borrowerId);
|
|
164
167
|
return {
|
|
165
168
|
extraInfo,
|
|
166
169
|
lastBBCDate,
|
|
@@ -253,7 +256,8 @@ class BorrowerService {
|
|
|
253
256
|
async getBorrowerStatementDetails(borrowers) {
|
|
254
257
|
const allBorrowersWithExtraInfo = await Promise.all(borrowers.map(async (borrower) => {
|
|
255
258
|
const borrowerId = borrower._id.toString();
|
|
256
|
-
const
|
|
259
|
+
const loanStatementStatusService = this.getLoanStatementStatusService();
|
|
260
|
+
const statementStatuses = await loanStatementStatusService.getBorrowerStatement(borrowerId);
|
|
257
261
|
return { [borrowerId]: statementStatuses };
|
|
258
262
|
}));
|
|
259
263
|
return allBorrowersWithExtraInfo.reduce((acc, borrower) => {
|
|
@@ -43,10 +43,10 @@ export const borrowerDataModels: {
|
|
|
43
43
|
export class BorrowerService {
|
|
44
44
|
|
|
45
45
|
constructor(
|
|
46
|
-
private readonly
|
|
47
|
-
private readonly
|
|
48
|
-
private readonly
|
|
49
|
-
private readonly
|
|
46
|
+
private readonly getCollateralsService: () => CollateralsService,
|
|
47
|
+
private readonly getLoanStatementStatusService: () => LoanStatementStatusService,
|
|
48
|
+
private readonly getLoanTransactionsService: () => LoanTransactionsService,
|
|
49
|
+
private readonly getSignsService: () => SignsService,
|
|
50
50
|
) {
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -179,9 +179,12 @@ export class BorrowerService {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
async getExtraInfo(borrowerId: string) {
|
|
182
|
-
const
|
|
183
|
-
const
|
|
184
|
-
const
|
|
182
|
+
const loanTransactionsService = this.getLoanTransactionsService();
|
|
183
|
+
const collateralsService = this.getCollateralsService();
|
|
184
|
+
const signsService = this.getSignsService();
|
|
185
|
+
const extraInfo = await loanTransactionsService.getLoanBalanceForBorrowerId(borrowerId);
|
|
186
|
+
const { lastBBCDate, lastBBCId } = await collateralsService.getLatestBBCDate(borrowerId);
|
|
187
|
+
const lastSignedBBCDate = await signsService.getLatestSignedBBCDate(borrowerId);
|
|
185
188
|
return {
|
|
186
189
|
extraInfo,
|
|
187
190
|
lastBBCDate,
|
|
@@ -287,7 +290,8 @@ export class BorrowerService {
|
|
|
287
290
|
async getBorrowerStatementDetails(borrowers: IBorrowerDocument[]) {
|
|
288
291
|
const allBorrowersWithExtraInfo = await Promise.all(borrowers.map(async (borrower) => {
|
|
289
292
|
const borrowerId = borrower._id.toString();
|
|
290
|
-
const
|
|
293
|
+
const loanStatementStatusService = this.getLoanStatementStatusService();
|
|
294
|
+
const statementStatuses = await loanStatementStatusService.getBorrowerStatement(borrowerId);
|
|
291
295
|
return { [borrowerId]: statementStatuses };
|
|
292
296
|
}));
|
|
293
297
|
return allBorrowersWithExtraInfo.reduce((acc, borrower) => {
|
|
@@ -45,7 +45,7 @@ export declare class ComplianceBorrowersService {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
getFullComplianceBorrowerById(complianceBorrowerId: any): Promise<any>;
|
|
48
|
-
getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "
|
|
48
|
+
getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "borrower" | "fundingStatus" | "items"> | {
|
|
49
49
|
items: {
|
|
50
50
|
instances: any[];
|
|
51
51
|
item: import("../models/ComplianceItem.model").IComplianceItemDocument;
|