gemcap-be-common 1.5.68 → 1.5.69
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
|
@@ -84,10 +84,10 @@ export declare class BorrowerService {
|
|
|
84
84
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
85
85
|
getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
|
|
86
86
|
[x: string]: {
|
|
87
|
-
SELECTED_PERIOD?: boolean;
|
|
88
|
-
ENTIRE_LOAN?: boolean;
|
|
89
87
|
LAST_MONTH?: boolean;
|
|
90
88
|
CURRENT_MONTH?: boolean;
|
|
89
|
+
ENTIRE_LOAN?: boolean;
|
|
90
|
+
SELECTED_PERIOD?: boolean;
|
|
91
91
|
TERM_LOAN?: boolean;
|
|
92
92
|
};
|
|
93
93
|
}>;
|
|
@@ -23,27 +23,28 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
|
-
import { IEmailRecipient } from '../models/ComplianceItem.model';
|
|
26
|
+
import { IBorrowerItemDocument, IBorrowerItemInstanceDocument, IEmailRecipient } from '../models/ComplianceItem.model';
|
|
27
27
|
import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
|
|
28
28
|
import { IComplianceBorrowerWithBorrower, IComplianceBorrowerDocumentFull, IComplianceBorrowerWithPlaidToken } from '../models/BorrowerCompliance.model';
|
|
29
29
|
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
30
30
|
import { FileManagerService } from './file-manager.service';
|
|
31
31
|
import { UploadsService } from './uploads.service';
|
|
32
|
+
export interface IInstanceStatus {
|
|
33
|
+
progress: {
|
|
34
|
+
text: string;
|
|
35
|
+
status: string;
|
|
36
|
+
};
|
|
37
|
+
score: {
|
|
38
|
+
value: number;
|
|
39
|
+
tooltip: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
32
42
|
export declare class ComplianceBorrowersService {
|
|
33
43
|
private readonly _fileManagerService;
|
|
34
44
|
private readonly _uploadsService;
|
|
35
45
|
constructor(_fileManagerService: FileManagerService, _uploadsService: UploadsService);
|
|
36
46
|
isComplianceBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean;
|
|
37
|
-
calculateInstanceStatuses(instance:
|
|
38
|
-
progress: {
|
|
39
|
-
text: string;
|
|
40
|
-
status: string;
|
|
41
|
-
};
|
|
42
|
-
score: {
|
|
43
|
-
value: number;
|
|
44
|
-
tooltip: string;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
+
calculateInstanceStatuses(instance: IBorrowerItemInstanceDocument, item: IBorrowerItemDocument): IInstanceStatus;
|
|
47
48
|
getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any>;
|
|
48
49
|
getAllBorrowersShortened(userAccess: IUserAccess): Promise<(Pick<IComplianceBorrowerWithBorrower, "borrower" | "fundingStatus" | "items"> | {
|
|
49
50
|
items: {
|
|
@@ -2,7 +2,12 @@ import dayjs, { ManipulateType } from 'dayjs';
|
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import mongoose from 'mongoose';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IBorrowerItemDocument,
|
|
7
|
+
IBorrowerItemInstanceDocument,
|
|
8
|
+
IComplianceFile,
|
|
9
|
+
IEmailRecipient,
|
|
10
|
+
} from '../models/ComplianceItem.model';
|
|
6
11
|
import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
|
|
7
12
|
import { EItemProgressStatus } from '../enums/item-progress-status.enum';
|
|
8
13
|
import {
|
|
@@ -35,6 +40,17 @@ const dueDifference = (date) => {
|
|
|
35
40
|
return currentDate.diff(nextDate, 'day');
|
|
36
41
|
};
|
|
37
42
|
|
|
43
|
+
export interface IInstanceStatus {
|
|
44
|
+
progress: {
|
|
45
|
+
text: string;
|
|
46
|
+
status: string;
|
|
47
|
+
};
|
|
48
|
+
score: {
|
|
49
|
+
value: number;
|
|
50
|
+
tooltip: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
38
54
|
export class ComplianceBorrowersService {
|
|
39
55
|
|
|
40
56
|
constructor(
|
|
@@ -51,7 +67,7 @@ export class ComplianceBorrowersService {
|
|
|
51
67
|
return true;
|
|
52
68
|
}
|
|
53
69
|
|
|
54
|
-
calculateInstanceStatuses(instance, item) {
|
|
70
|
+
calculateInstanceStatuses(instance: IBorrowerItemInstanceDocument, item: IBorrowerItemDocument): IInstanceStatus {
|
|
55
71
|
let progress: { text: string, status: string };
|
|
56
72
|
let score: { value: number, tooltip: string } = null;
|
|
57
73
|
if (instance.submittedDate) {
|
|
@@ -77,7 +93,7 @@ export class ComplianceBorrowersService {
|
|
|
77
93
|
return { progress, score };
|
|
78
94
|
}
|
|
79
95
|
|
|
80
|
-
async getFullComplianceBorrowerById(complianceBorrowerId: string)
|
|
96
|
+
async getFullComplianceBorrowerById(complianceBorrowerId: string) {
|
|
81
97
|
if (!complianceBorrowerId) {
|
|
82
98
|
return null;
|
|
83
99
|
}
|
|
@@ -109,7 +125,7 @@ export class ComplianceBorrowersService {
|
|
|
109
125
|
return Promise.resolve(null);
|
|
110
126
|
}
|
|
111
127
|
|
|
112
|
-
const items = { items: [], ...ourBorrower }.items.map((item) => {
|
|
128
|
+
const items = { items: [] as IBorrowerItemDocument[], ...ourBorrower }.items.map((item) => {
|
|
113
129
|
return {
|
|
114
130
|
...item,
|
|
115
131
|
instances: item.instances.reduce((acc, instance) => {
|
|
@@ -124,7 +140,10 @@ export class ComplianceBorrowersService {
|
|
|
124
140
|
console.error({ e });
|
|
125
141
|
return acc;
|
|
126
142
|
}
|
|
127
|
-
},
|
|
143
|
+
}, <(IBorrowerItemInstanceDocument & IInstanceStatus & {
|
|
144
|
+
itemId: mongoose.Types.ObjectId,
|
|
145
|
+
files: IComplianceFile[]
|
|
146
|
+
})[]>[]),
|
|
128
147
|
};
|
|
129
148
|
});
|
|
130
149
|
return Promise.resolve({ ...ourBorrower, items });
|
|
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
|
|
|
155
155
|
getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
|
|
156
156
|
transactionIdsToMark: string[];
|
|
157
157
|
transactions: {
|
|
158
|
-
[x: string]: (string | number |
|
|
158
|
+
[x: string]: (string | number | string[] | Date)[];
|
|
159
159
|
}[];
|
|
160
160
|
}>;
|
|
161
161
|
getBorrowerIdsForFile(transactionFileId: string): Promise<{
|