gemcap-be-common 1.4.71 → 1.4.72
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/db/new-summary.ts +2 -2
- package/models/Borrower.model.d.ts +23 -9
- package/models/Borrower.model.ts +20 -3
- package/models/FinancialComplianceBorrower.model.d.ts +2 -2
- package/models/FinancialComplianceBorrower.model.ts +2 -2
- package/package.json +1 -1
- package/services/borrowers.db.d.ts +6 -6
- package/services/borrowers.service.d.ts +7 -7
- package/services/borrowers.service.ts +4 -4
- package/services/file-manager.service.d.ts +2 -2
- package/services/file-manager.service.ts +2 -2
- package/services/loan-transactions.service.d.ts +1 -1
- package/services/reports.service.d.ts +2 -2
- package/services/signs.service.d.ts +2 -2
- package/services/signs.service.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/db/new-summary.ts
CHANGED
|
@@ -5,7 +5,7 @@ import _ from 'lodash';
|
|
|
5
5
|
|
|
6
6
|
import { reorderObject } from '../helpers/common.helper';
|
|
7
7
|
import { getLastTransactionForDate } from './loan-transactions.db';
|
|
8
|
-
import { BorrowerModel,
|
|
8
|
+
import { BorrowerModel, IBorrowerDoc } from '../models/Borrower.model';
|
|
9
9
|
import { ILoanProductDoc, LoanProduct } from '../models/LoanProducts.model';
|
|
10
10
|
import { getAverageActualBalance } from './loan-products.db';
|
|
11
11
|
import { LoanStatementTransactionModel } from '../models/LoanStatementTransaction.model';
|
|
@@ -148,7 +148,7 @@ const borrowerTitleLength = 15;
|
|
|
148
148
|
const dateFormat = 'MM-DD-YYYY';
|
|
149
149
|
|
|
150
150
|
const productsDataMap = new Map<string, ReportRow>();
|
|
151
|
-
const borrowersMap = new Map<string,
|
|
151
|
+
const borrowersMap = new Map<string, IBorrowerDoc>();
|
|
152
152
|
const productsMap = new Map<string, ILoanProductDoc>();
|
|
153
153
|
const chargesMap = new Map<string, ILoanChargeDoc>();
|
|
154
154
|
const complianceBorrowersMap = new Map<string, IComplianceBorrowerDocument>();
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import mongoose, { Document } from 'mongoose';
|
|
25
|
+
import mongoose, { Document, Model } from 'mongoose';
|
|
26
26
|
import { IOrganization } from './Organization.model';
|
|
27
27
|
interface ISchemaItem {
|
|
28
28
|
column: string;
|
|
@@ -42,18 +42,32 @@ export interface IBorrower {
|
|
|
42
42
|
organizationId: IOrganization;
|
|
43
43
|
schemas: IMapSchema[];
|
|
44
44
|
}
|
|
45
|
-
export interface
|
|
45
|
+
export interface IBorrowerDoc extends IBorrower, Document {
|
|
46
|
+
_id: mongoose.Types.ObjectId;
|
|
47
|
+
createdAt: Date;
|
|
48
|
+
updatedAt: Date;
|
|
49
|
+
}
|
|
50
|
+
export interface IBorrowerLean extends IBorrower {
|
|
51
|
+
_id: mongoose.Types.ObjectId;
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
updatedAt: Date;
|
|
54
|
+
}
|
|
55
|
+
export interface IBorrowerPlain extends IBorrower {
|
|
56
|
+
_id: string;
|
|
57
|
+
createdAt: Date;
|
|
58
|
+
updatedAt: Date;
|
|
46
59
|
}
|
|
60
|
+
export type BorrowerModel = Model<IBorrowerDoc>;
|
|
47
61
|
export declare const BorrowerSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
48
62
|
timestamps: true;
|
|
49
63
|
}, {
|
|
50
64
|
createdAt: NativeDate;
|
|
51
65
|
updatedAt: NativeDate;
|
|
52
66
|
} & {
|
|
53
|
-
name: string;
|
|
54
|
-
active: boolean;
|
|
55
67
|
code: string;
|
|
68
|
+
name: string;
|
|
56
69
|
title: string;
|
|
70
|
+
active: boolean;
|
|
57
71
|
accrualStatus: boolean;
|
|
58
72
|
__v?: number;
|
|
59
73
|
organizationId?: mongoose.Types.ObjectId;
|
|
@@ -69,10 +83,10 @@ export declare const BorrowerSchema: mongoose.Schema<any, mongoose.Model<any, an
|
|
|
69
83
|
createdAt: NativeDate;
|
|
70
84
|
updatedAt: NativeDate;
|
|
71
85
|
} & {
|
|
72
|
-
name: string;
|
|
73
|
-
active: boolean;
|
|
74
86
|
code: string;
|
|
87
|
+
name: string;
|
|
75
88
|
title: string;
|
|
89
|
+
active: boolean;
|
|
76
90
|
accrualStatus: boolean;
|
|
77
91
|
__v?: number;
|
|
78
92
|
organizationId?: mongoose.Types.ObjectId;
|
|
@@ -88,10 +102,10 @@ export declare const BorrowerSchema: mongoose.Schema<any, mongoose.Model<any, an
|
|
|
88
102
|
createdAt: NativeDate;
|
|
89
103
|
updatedAt: NativeDate;
|
|
90
104
|
} & {
|
|
91
|
-
name: string;
|
|
92
|
-
active: boolean;
|
|
93
105
|
code: string;
|
|
106
|
+
name: string;
|
|
94
107
|
title: string;
|
|
108
|
+
active: boolean;
|
|
95
109
|
accrualStatus: boolean;
|
|
96
110
|
__v?: number;
|
|
97
111
|
organizationId?: mongoose.Types.ObjectId;
|
|
@@ -106,5 +120,5 @@ export declare const BorrowerSchema: mongoose.Schema<any, mongoose.Model<any, an
|
|
|
106
120
|
}> & {
|
|
107
121
|
_id: mongoose.Types.ObjectId;
|
|
108
122
|
}>;
|
|
109
|
-
export declare const BorrowerModel: mongoose.Model<
|
|
123
|
+
export declare const BorrowerModel: mongoose.Model<IBorrowerDoc>;
|
|
110
124
|
export {};
|
package/models/Borrower.model.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose, { Document } from 'mongoose';
|
|
1
|
+
import mongoose, { Document, Model } from 'mongoose';
|
|
2
2
|
import { MODEL_NAMES } from './_models';
|
|
3
3
|
import { IOrganization } from './Organization.model';
|
|
4
4
|
|
|
@@ -25,9 +25,26 @@ export interface IBorrower {
|
|
|
25
25
|
schemas: IMapSchema[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export interface
|
|
28
|
+
export interface IBorrowerDoc extends IBorrower, Document {
|
|
29
|
+
_id: mongoose.Types.ObjectId;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
updatedAt: Date;
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
export interface IBorrowerLean extends IBorrower {
|
|
35
|
+
_id: mongoose.Types.ObjectId;
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
updatedAt: Date;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface IBorrowerPlain extends IBorrower {
|
|
41
|
+
_id: string;
|
|
42
|
+
createdAt: Date;
|
|
43
|
+
updatedAt: Date;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type BorrowerModel = Model<IBorrowerDoc>;
|
|
47
|
+
|
|
31
48
|
export const BorrowerSchema = new mongoose.Schema(
|
|
32
49
|
{
|
|
33
50
|
code: {
|
|
@@ -106,4 +123,4 @@ BorrowerSchema.pre(/^(findOneAndDelete|deleteOne|deleteMany)/, async function()
|
|
|
106
123
|
|
|
107
124
|
BorrowerSchema.plugin(mongooseLeanId);
|
|
108
125
|
|
|
109
|
-
export const BorrowerModel: mongoose.Model<
|
|
126
|
+
export const BorrowerModel: mongoose.Model<IBorrowerDoc> = mongoose.model<IBorrowerDoc>(MODEL_NAMES.borrowers, BorrowerSchema);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from 'mongoose';
|
|
26
|
-
import {
|
|
26
|
+
import { IBorrowerDoc } from './Borrower.model';
|
|
27
27
|
import { IEmailRecipient } from './ComplianceItem.model';
|
|
28
28
|
export interface IFinancialComplianceBorrowerSettings {
|
|
29
29
|
invoiceSentDate: Date;
|
|
@@ -40,7 +40,7 @@ export interface IFinancialComplianceBorrowerSettings {
|
|
|
40
40
|
reminderCounter: number;
|
|
41
41
|
}
|
|
42
42
|
export interface IFinancialComplianceBorrower extends IFinancialComplianceBorrowerSettings {
|
|
43
|
-
borrower:
|
|
43
|
+
borrower: IBorrowerDoc;
|
|
44
44
|
}
|
|
45
45
|
export interface IFinancialComplianceBorrowerDocument extends IFinancialComplianceBorrower, Document {
|
|
46
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose, { Document } from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { MODEL_NAMES } from './_models';
|
|
4
|
-
import {
|
|
4
|
+
import { IBorrowerDoc } from './Borrower.model';
|
|
5
5
|
import { IEmailRecipient } from './ComplianceItem.model';
|
|
6
6
|
|
|
7
7
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
@@ -22,7 +22,7 @@ export interface IFinancialComplianceBorrowerSettings {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface IFinancialComplianceBorrower extends IFinancialComplianceBorrowerSettings {
|
|
25
|
-
borrower:
|
|
25
|
+
borrower: IBorrowerDoc;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface IFinancialComplianceBorrowerDocument extends IFinancialComplianceBorrower, Document {
|
package/package.json
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
/// <reference types="mongoose/types/inferschematype" />
|
|
26
26
|
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
27
27
|
export declare class BorrowersDB {
|
|
28
|
-
getAllBorrowers(): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").
|
|
28
|
+
getAllBorrowers(): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").IBorrowerDoc> & Required<{
|
|
29
29
|
_id: import("mongoose").Types.ObjectId;
|
|
30
|
-
})[]>;
|
|
31
|
-
getActiveBorrowers(): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").
|
|
30
|
+
}>)[]>;
|
|
31
|
+
getActiveBorrowers(): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").IBorrowerDoc> & Required<{
|
|
32
32
|
_id: import("mongoose").Types.ObjectId;
|
|
33
|
-
})[]>;
|
|
34
|
-
getAllowedBorrowers(user: IUserAccess): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").
|
|
33
|
+
}>)[]>;
|
|
34
|
+
getAllowedBorrowers(user: IUserAccess): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").IBorrowerDoc> & Required<{
|
|
35
35
|
_id: import("mongoose").Types.ObjectId;
|
|
36
|
-
})[]>;
|
|
36
|
+
}>)[]>;
|
|
37
37
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
26
|
import { IBorrowerSettingsDocPopulated } from '../models/BorrowerSettings.model';
|
|
27
|
-
import {
|
|
27
|
+
import { IBorrowerDoc } from '../models/Borrower.model';
|
|
28
28
|
import { IBorrowerDataDocWithName } from '../models/BorrowerData.model';
|
|
29
29
|
import { CollateralsService } from './collaterals.service';
|
|
30
30
|
import { LoanStatementStatusService } from './loan-statement-status.service';
|
|
@@ -42,17 +42,17 @@ export declare class BorrowerService {
|
|
|
42
42
|
constructor(getCollateralsService: () => CollateralsService, getLoanStatementStatusService: () => LoanStatementStatusService, getLoanTransactionsService: () => LoanTransactionsService, getSignsService: () => SignsService);
|
|
43
43
|
isBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean;
|
|
44
44
|
checkBorrower(user: IUser, requestedBorrowerId: string): boolean;
|
|
45
|
-
getBorrowerById(borrowerId: string): Promise<mongoose.FlattenMaps<
|
|
45
|
+
getBorrowerById(borrowerId: string): Promise<mongoose.FlattenMaps<IBorrowerDoc> & Required<{
|
|
46
46
|
_id: mongoose.Types.ObjectId;
|
|
47
|
-
}
|
|
48
|
-
isNameCodeAllowed(borrower:
|
|
47
|
+
}>>;
|
|
48
|
+
isNameCodeAllowed(borrower: IBorrowerDoc): Promise<{
|
|
49
49
|
message: string;
|
|
50
50
|
}>;
|
|
51
51
|
private getDefaultSettings;
|
|
52
52
|
private addOptionNames;
|
|
53
53
|
getBorrowerOption(borrowerId: string, optionName: string): Promise<IBorrowerDataDocWithName>;
|
|
54
54
|
getBorrowerSettings(borrowerId: string): Promise<IBorrowerSettingsDocPopulated>;
|
|
55
|
-
getBorrowerByCode(code: string): Promise<
|
|
55
|
+
getBorrowerByCode(code: string): Promise<IBorrowerDoc>;
|
|
56
56
|
getExtraInfo(borrowerId: string): Promise<{
|
|
57
57
|
extraInfo: {
|
|
58
58
|
REVOLVER: {
|
|
@@ -82,8 +82,8 @@ export declare class BorrowerService {
|
|
|
82
82
|
}>;
|
|
83
83
|
updateBorrowerSettings(borrowerId: string, borrowerSettings: IBorrowerSettingsDocPopulated): Promise<void>;
|
|
84
84
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
85
|
-
getBorrowerStatementDetails(borrowers:
|
|
86
|
-
[x:
|
|
85
|
+
getBorrowerStatementDetails(borrowers: IBorrowerDoc[]): Promise<{
|
|
86
|
+
[x: string]: {
|
|
87
87
|
LAST_MONTH?: boolean;
|
|
88
88
|
CURRENT_MONTH?: boolean;
|
|
89
89
|
ENTIRE_LOAN?: boolean;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
IBorrowerSettings,
|
|
6
6
|
IBorrowerSettingsDocPopulated,
|
|
7
7
|
} from '../models/BorrowerSettings.model';
|
|
8
|
-
import { BorrowerModel,
|
|
8
|
+
import { BorrowerModel, IBorrowerDoc } from '../models/Borrower.model';
|
|
9
9
|
import {
|
|
10
10
|
BorrowerDataModel,
|
|
11
11
|
BorrowerDataOptionModel,
|
|
@@ -73,7 +73,7 @@ export class BorrowerService {
|
|
|
73
73
|
return BorrowerModel.findById(borrowerId).lean();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
async isNameCodeAllowed(borrower:
|
|
76
|
+
async isNameCodeAllowed(borrower: IBorrowerDoc) {
|
|
77
77
|
const existingUserName = await BorrowerModel.findOne({ name: borrower.name });
|
|
78
78
|
const existingUserCode = await BorrowerModel.findOne({ code: borrower.code });
|
|
79
79
|
if (existingUserName && existingUserName.id !== borrower._id) {
|
|
@@ -177,7 +177,7 @@ export class BorrowerService {
|
|
|
177
177
|
return await this.addOptionNames(unmappedSettings as IBorrowerSettingsDocPopulated);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
async getBorrowerByCode(code: string): Promise<
|
|
180
|
+
async getBorrowerByCode(code: string): Promise<IBorrowerDoc> {
|
|
181
181
|
return BorrowerModel.findOne({ code });
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -274,7 +274,7 @@ export class BorrowerService {
|
|
|
274
274
|
return codesMap;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
async getBorrowerStatementDetails(borrowers:
|
|
277
|
+
async getBorrowerStatementDetails(borrowers: IBorrowerDoc[]) {
|
|
278
278
|
const allBorrowersWithExtraInfo = await Promise.all(borrowers.map(async (borrower) => {
|
|
279
279
|
const borrowerId = borrower._id.toString();
|
|
280
280
|
const loanStatementStatusService = this.getLoanStatementStatusService();
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
|
-
import {
|
|
26
|
+
import { IBorrowerDoc } from '../models/Borrower.model';
|
|
27
27
|
import { IComplianceFile } from '../models/ComplianceItem.model';
|
|
28
28
|
import { ComplianceBorrowersService } from './compliance-borrowers.service';
|
|
29
29
|
export type BorrowerWithFiles = {
|
|
30
30
|
_id: mongoose.Types.ObjectId;
|
|
31
|
-
borrower:
|
|
31
|
+
borrower: IBorrowerDoc;
|
|
32
32
|
files: IComplianceFile[];
|
|
33
33
|
};
|
|
34
34
|
export declare class FileManagerService {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { BorrowerCompliance } from '../models/BorrowerCompliance.model';
|
|
4
|
-
import {
|
|
4
|
+
import { IBorrowerDoc } from '../models/Borrower.model';
|
|
5
5
|
import { IComplianceFile } from '../models/ComplianceItem.model';
|
|
6
6
|
|
|
7
7
|
import { ComplianceBorrowersService } from './compliance-borrowers.service';
|
|
8
8
|
|
|
9
9
|
export type BorrowerWithFiles = {
|
|
10
10
|
_id: mongoose.Types.ObjectId;
|
|
11
|
-
borrower:
|
|
11
|
+
borrower: IBorrowerDoc;
|
|
12
12
|
files: IComplianceFile[]
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -155,7 +155,7 @@ export declare class LoanTransactionsService {
|
|
|
155
155
|
getTransactionReport(transactionIds: string[], borrowerId: string, effectiveDate: Date): Promise<{
|
|
156
156
|
transactionIdsToMark: any[];
|
|
157
157
|
transactions: {
|
|
158
|
-
[x: string]: (string | number | string[]
|
|
158
|
+
[x: string]: (string | number | Date | string[])[];
|
|
159
159
|
}[];
|
|
160
160
|
}>;
|
|
161
161
|
getBorrowerIdsForFile(transactionFileId: string): Promise<{
|
|
@@ -100,9 +100,9 @@ export declare class ReportsService {
|
|
|
100
100
|
getCollateralAdjustmentsForLastSignedBBC(borrowerId: string, date: Date): Promise<number>;
|
|
101
101
|
private getProductBalances;
|
|
102
102
|
getBorrowerAndProducts(borrowerId: string, date: Date, useSignedBBC?: boolean, requireBBC?: boolean): Promise<{
|
|
103
|
-
borrower: import("mongoose").Document<unknown, {}, import("../models/Borrower.model").
|
|
103
|
+
borrower: import("mongoose").Document<unknown, {}, import("../models/Borrower.model").IBorrowerDoc> & import("../models/Borrower.model").IBorrowerDoc & Required<{
|
|
104
104
|
_id: import("mongoose").Types.ObjectId;
|
|
105
|
-
}
|
|
105
|
+
}>;
|
|
106
106
|
latestBBC: import("../models/BBCDate.model").IBBCDateDoc;
|
|
107
107
|
summaries: import("./availability.service").IAvailabilityFullSummary;
|
|
108
108
|
products: import("../models/LoanProducts.model").ILoanProductView[];
|
|
@@ -26,7 +26,7 @@ import mongoose, { Document } from 'mongoose';
|
|
|
26
26
|
import { IResult } from '../interfaces/result.interface';
|
|
27
27
|
import { IAvailabilitySignView } from '../models/AvailabilitySigns.model';
|
|
28
28
|
import { IBBCDateDoc } from '../models/BBCDate.model';
|
|
29
|
-
import {
|
|
29
|
+
import { IBorrowerDoc } from '../models/Borrower.model';
|
|
30
30
|
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
31
31
|
import { UsersService } from './users.service';
|
|
32
32
|
import { LoanTransactionsService } from './loan-transactions.service';
|
|
@@ -34,7 +34,7 @@ import { LockService } from './lock.service';
|
|
|
34
34
|
import { LoanStatementService } from './loan-statement.service';
|
|
35
35
|
import { IUser } from '../interfaces/auth-user.interface';
|
|
36
36
|
export interface IBBCDateWithBorrower extends Document {
|
|
37
|
-
borrowerId:
|
|
37
|
+
borrowerId: IBorrowerDoc;
|
|
38
38
|
bbcDate: Date;
|
|
39
39
|
}
|
|
40
40
|
export declare enum ESignStatus {
|
|
@@ -19,7 +19,7 @@ import { MODEL_NAMES } from '../models/_models';
|
|
|
19
19
|
import { getOlderBBCDates } from '../db/bbcDates.db';
|
|
20
20
|
import { ELogActionType, ELogType } from '../models/UserLog.model';
|
|
21
21
|
import { createLog, ICreateLogParams } from '../db/user-logs.db';
|
|
22
|
-
import {
|
|
22
|
+
import { IBorrowerDoc } from '../models/Borrower.model';
|
|
23
23
|
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
24
24
|
import { ITEMS_PAGINATION } from '../db/collaterals.db';
|
|
25
25
|
import { UsersService } from './users.service';
|
|
@@ -30,7 +30,7 @@ import { LoanStatementService } from './loan-statement.service';
|
|
|
30
30
|
import { IUser } from '../interfaces/auth-user.interface';
|
|
31
31
|
|
|
32
32
|
export interface IBBCDateWithBorrower extends Document {
|
|
33
|
-
borrowerId:
|
|
33
|
+
borrowerId: IBorrowerDoc;
|
|
34
34
|
bbcDate: Date;
|
|
35
35
|
}
|
|
36
36
|
|