gemcap-be-common 1.5.73 → 1.5.75
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/classes/sales-item.d.ts +3 -1
- package/classes/sales-item.js +8 -1
- package/classes/sales-item.ts +8 -1
- package/helpers/column-desciptions.helper.js +2 -2
- package/helpers/column-desciptions.helper.ts +2 -2
- package/package.json +1 -1
- package/services/borrowers.service.d.ts +2 -2
- package/services/compliance-borrowers.service.d.ts +6 -7
- package/services/compliance-borrowers.service.ts +5 -3
- package/services/loan-transactions.service.d.ts +1 -1
- package/services/uploads.service.js +1 -1
- package/services/uploads.service.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/classes/sales-item.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare class SalesItem implements ISalesLocal {
|
|
|
17
17
|
unitSalePrice: number;
|
|
18
18
|
salesPeriodStart: Date | null;
|
|
19
19
|
salesPeriodEnd: Date | null;
|
|
20
|
-
constructor(item: Partial<SalesItem>, bbcDate
|
|
20
|
+
constructor(item: Partial<SalesItem>, bbcDate: any, options: {
|
|
21
|
+
[extraOption: string]: string;
|
|
22
|
+
});
|
|
21
23
|
}
|
|
22
24
|
export {};
|
package/classes/sales-item.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SalesItem = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
9
|
const column_desciptions_helper_1 = require("../helpers/column-desciptions.helper");
|
|
9
10
|
const collaterals_enum_1 = require("../enums/collaterals.enum");
|
|
10
11
|
class SalesItem {
|
|
@@ -16,7 +17,13 @@ class SalesItem {
|
|
|
16
17
|
unitSalePrice = 0;
|
|
17
18
|
salesPeriodStart = null;
|
|
18
19
|
salesPeriodEnd = null;
|
|
19
|
-
constructor(item, bbcDate = null) {
|
|
20
|
+
constructor(item, bbcDate = null, options) {
|
|
21
|
+
if (options && options.salesPeriodStart) {
|
|
22
|
+
item.salesPeriodStart = dayjs_1.default.utc(options.salesPeriodStart).toDate();
|
|
23
|
+
}
|
|
24
|
+
if (options && options.salesPeriodEnd) {
|
|
25
|
+
item.salesPeriodEnd = dayjs_1.default.utc(options.salesPeriodEnd).toDate();
|
|
26
|
+
}
|
|
20
27
|
const itemWithDates = (0, column_desciptions_helper_1.convertIntoDates)(item, collaterals_enum_1.ECollaterals.SALES);
|
|
21
28
|
const itemWithoutNulls = lodash_1.default.omitBy(itemWithDates, (value) => value === null);
|
|
22
29
|
Object.assign(this, itemWithoutNulls);
|
package/classes/sales-item.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
2
3
|
|
|
3
4
|
import { convertIntoDates } from '../helpers/column-desciptions.helper';
|
|
4
5
|
import { ECollaterals } from '../enums/collaterals.enum';
|
|
@@ -25,7 +26,13 @@ export class SalesItem implements ISalesLocal {
|
|
|
25
26
|
salesPeriodStart: Date | null = null;
|
|
26
27
|
salesPeriodEnd: Date | null = null;
|
|
27
28
|
|
|
28
|
-
constructor(item: Partial<SalesItem>, bbcDate = null) {
|
|
29
|
+
constructor(item: Partial<SalesItem>, bbcDate = null, options: { [extraOption: string]: string }) {
|
|
30
|
+
if (options && options.salesPeriodStart) {
|
|
31
|
+
item.salesPeriodStart = dayjs.utc(options.salesPeriodStart).toDate();
|
|
32
|
+
}
|
|
33
|
+
if (options && options.salesPeriodEnd) {
|
|
34
|
+
item.salesPeriodEnd = dayjs.utc(options.salesPeriodEnd).toDate();
|
|
35
|
+
}
|
|
29
36
|
const itemWithDates = convertIntoDates(item, ECollaterals.SALES);
|
|
30
37
|
const itemWithoutNulls = _.omitBy(itemWithDates, (value) => value === null);
|
|
31
38
|
Object.assign(this, itemWithoutNulls);
|
|
@@ -260,14 +260,14 @@ exports.COLLATERALS = {
|
|
|
260
260
|
title: 'Sales period start',
|
|
261
261
|
required: true,
|
|
262
262
|
items: [],
|
|
263
|
-
validators: [validators_enums_1.EValidators.
|
|
263
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
db_title: 'salesPeriodEnd',
|
|
267
267
|
title: 'Sales period end',
|
|
268
268
|
required: true,
|
|
269
269
|
items: [],
|
|
270
|
-
validators: [validators_enums_1.EValidators.
|
|
270
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
271
271
|
},
|
|
272
272
|
],
|
|
273
273
|
[collaterals_enum_1.ECollaterals.LOAN_TRANSACTIONS]: [
|
|
@@ -260,14 +260,14 @@ COLLATERALS = {
|
|
|
260
260
|
title: 'Sales period start',
|
|
261
261
|
required: true,
|
|
262
262
|
items: [],
|
|
263
|
-
validators: [EValidators.
|
|
263
|
+
validators: [EValidators.IS_DATE],
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
db_title: 'salesPeriodEnd',
|
|
267
267
|
title: 'Sales period end',
|
|
268
268
|
required: true,
|
|
269
269
|
items: [],
|
|
270
|
-
validators: [EValidators.
|
|
270
|
+
validators: [EValidators.IS_DATE],
|
|
271
271
|
},
|
|
272
272
|
],
|
|
273
273
|
[ECollaterals.LOAN_TRANSACTIONS]: [
|
package/package.json
CHANGED
|
@@ -86,10 +86,10 @@ export declare class BorrowerService {
|
|
|
86
86
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
87
87
|
getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
|
|
88
88
|
[x: string]: {
|
|
89
|
-
SELECTED_PERIOD?: boolean;
|
|
90
|
-
ENTIRE_LOAN?: boolean;
|
|
91
89
|
LAST_MONTH?: boolean;
|
|
92
90
|
CURRENT_MONTH?: boolean;
|
|
91
|
+
ENTIRE_LOAN?: boolean;
|
|
92
|
+
SELECTED_PERIOD?: boolean;
|
|
93
93
|
TERM_LOAN?: boolean;
|
|
94
94
|
};
|
|
95
95
|
}>;
|
|
@@ -50,19 +50,18 @@ export interface IBorrowerItemInstanceWithStatusesLean extends IBorrowerItemInst
|
|
|
50
50
|
export interface IBorrowerItemWithStatusesLean extends Omit<IBorrowerItemLean, 'instances'> {
|
|
51
51
|
instances: IBorrowerItemInstanceWithStatusesLean[];
|
|
52
52
|
}
|
|
53
|
+
export interface IComplianceBorrowerDocumentFullWithStatuses extends Omit<IComplianceBorrowerDocumentFull, 'items'> {
|
|
54
|
+
items: IBorrowerItemWithStatusesLean[];
|
|
55
|
+
}
|
|
53
56
|
export declare class ComplianceBorrowersService {
|
|
54
57
|
private readonly _fileManagerService;
|
|
55
58
|
private readonly _uploadsService;
|
|
56
59
|
constructor(_fileManagerService: FileManagerService, _uploadsService: UploadsService);
|
|
57
60
|
isComplianceBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean;
|
|
58
61
|
calculateInstanceStatuses(instance: IBorrowerItemInstance, item: IBorrowerItemLean): IInstanceStatus;
|
|
59
|
-
getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
getAllBorrowersShortened(userAccess: IUserAccess): Promise<Pick<IComplianceBorrowerWithBorrower, "borrower" | "fundingStatus" | "items">[]>;
|
|
63
|
-
generateInstances(complianceBorrowerId: any): Promise<IComplianceBorrowerDocumentFull & {
|
|
64
|
-
items: IBorrowerItemWithStatusesLean[];
|
|
65
|
-
}>;
|
|
62
|
+
getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<IComplianceBorrowerDocumentFullWithStatuses>;
|
|
63
|
+
getAllBorrowersShortened(userAccess: IUserAccess): Promise<Pick<IComplianceBorrowerWithBorrower, "items" | "borrower" | "fundingStatus">[]>;
|
|
64
|
+
generateInstances(complianceBorrowerId: any): Promise<IComplianceBorrowerDocumentFullWithStatuses>;
|
|
66
65
|
calculateAndUpdateFundingStatus(complianceBorrowerId: string): Promise<void>;
|
|
67
66
|
calculateFundingStatus(complianceBorrower: IComplianceBorrowerDocumentFull): string;
|
|
68
67
|
updateComplianceBorrower(complianceBorrower: IComplianceBorrowerDocumentFull): Promise<mongoose.Document<unknown, {}, import("../models/BorrowerCompliance.model").IComplianceBorrowerDoc> & import("../models/BorrowerCompliance.model").IComplianceBorrowerDoc & Required<{
|
|
@@ -60,6 +60,10 @@ export interface IBorrowerItemWithStatusesLean extends Omit<IBorrowerItemLean, '
|
|
|
60
60
|
instances: IBorrowerItemInstanceWithStatusesLean[];
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
export interface IComplianceBorrowerDocumentFullWithStatuses extends Omit<IComplianceBorrowerDocumentFull, 'items'> {
|
|
64
|
+
items: IBorrowerItemWithStatusesLean[];
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
export class ComplianceBorrowersService {
|
|
64
68
|
|
|
65
69
|
constructor(
|
|
@@ -102,9 +106,7 @@ export class ComplianceBorrowersService {
|
|
|
102
106
|
return { progress, score };
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
async getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<
|
|
106
|
-
items: IBorrowerItemWithStatusesLean[];
|
|
107
|
-
}> {
|
|
109
|
+
async getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<IComplianceBorrowerDocumentFullWithStatuses> {
|
|
108
110
|
if (!complianceBorrowerId) {
|
|
109
111
|
return null;
|
|
110
112
|
}
|
|
@@ -163,7 +163,7 @@ export declare class LoanTransactionsService {
|
|
|
163
163
|
getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
|
|
164
164
|
transactionIdsToMark: string[];
|
|
165
165
|
transactions: {
|
|
166
|
-
[x: string]: (string | number |
|
|
166
|
+
[x: string]: (string | number | string[] | Date)[];
|
|
167
167
|
}[];
|
|
168
168
|
}>;
|
|
169
169
|
getBorrowerIdsForFile(transactionFileId: string): Promise<{
|
|
@@ -458,7 +458,7 @@ class UploadsService {
|
|
|
458
458
|
[collaterals_enum_1.ECollaterals.INVENTORY]: () => new inventory_item_1.InventoryItem(row, bbcDate, skuDates),
|
|
459
459
|
[collaterals_enum_1.ECollaterals.RECEIVABLE]: () => new receivable_item_1.ReceivableItem(row, bbcDate),
|
|
460
460
|
[collaterals_enum_1.ECollaterals.ACCOUNT_PAYABLE]: () => new payable_account_item_1.PayableAccountItem(row, bbcDate),
|
|
461
|
-
[collaterals_enum_1.ECollaterals.SALES]: () => new sales_item_1.SalesItem(row, bbcDate),
|
|
461
|
+
[collaterals_enum_1.ECollaterals.SALES]: () => new sales_item_1.SalesItem(row, bbcDate, mapData.extraOptions),
|
|
462
462
|
[collaterals_enum_1.ECollaterals.LOAN_TRANSACTIONS]: async () => {
|
|
463
463
|
const newItem = new bank_transaction_item_1.LoanTransactionItem(row, this.borrowersDB);
|
|
464
464
|
const classErrors = await newItem.initialize();
|
|
@@ -515,7 +515,7 @@ export class UploadsService {
|
|
|
515
515
|
[ECollaterals.INVENTORY]: () => new InventoryItem(row, bbcDate, skuDates),
|
|
516
516
|
[ECollaterals.RECEIVABLE]: () => new ReceivableItem(row, bbcDate),
|
|
517
517
|
[ECollaterals.ACCOUNT_PAYABLE]: () => new PayableAccountItem(row, bbcDate),
|
|
518
|
-
[ECollaterals.SALES]: () => new SalesItem(row, bbcDate),
|
|
518
|
+
[ECollaterals.SALES]: () => new SalesItem(row, bbcDate, mapData.extraOptions),
|
|
519
519
|
[ECollaterals.LOAN_TRANSACTIONS]: async () => {
|
|
520
520
|
const newItem = new LoanTransactionItem(row, this.borrowersDB);
|
|
521
521
|
const classErrors = await newItem.initialize();
|