gemcap-be-common 1.4.18 → 1.4.20
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 +1 -1
- package/services/borrowers.db.d.ts +2 -2
- package/services/borrowers.db.ts +2 -2
- package/services/borrowers.service.d.ts +2 -2
- package/services/borrowers.service.js +4 -4
- package/services/borrowers.service.ts +5 -5
- package/services/brokers.service.d.ts +2 -2
- package/services/compliance-borrowers.service.d.ts +2 -2
- package/services/compliance-borrowers.service.ts +2 -2
- package/services/loan-transactions.service.d.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose" />
|
|
25
25
|
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
-
import {
|
|
26
|
+
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
27
27
|
export declare class BorrowersDB {
|
|
28
28
|
getAllBorrowers(): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").IBorrowerDocument> & {
|
|
29
29
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -31,7 +31,7 @@ export declare class BorrowersDB {
|
|
|
31
31
|
getActiveBorrowers(): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").IBorrowerDocument> & {
|
|
32
32
|
_id: import("mongoose").Types.ObjectId;
|
|
33
33
|
})[]>;
|
|
34
|
-
getAllowedBorrowers(user:
|
|
34
|
+
getAllowedBorrowers(user: IUserAccess): Promise<(import("mongoose").FlattenMaps<import("../models/Borrower.model").IBorrowerDocument> & {
|
|
35
35
|
_id: import("mongoose").Types.ObjectId;
|
|
36
36
|
})[]>;
|
|
37
37
|
}
|
package/services/borrowers.db.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BorrowerModel } from '../models/Borrower.model';
|
|
2
|
-
import {
|
|
2
|
+
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
3
3
|
|
|
4
4
|
export class BorrowersDB {
|
|
5
5
|
async getAllBorrowers() {
|
|
@@ -10,7 +10,7 @@ export class BorrowersDB {
|
|
|
10
10
|
return BorrowerModel.find({ active: true }).sort({ name: 1 }).lean();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
async getAllowedBorrowers(user:
|
|
13
|
+
async getAllowedBorrowers(user: IUserAccess) {
|
|
14
14
|
return BorrowerModel
|
|
15
15
|
.find(user.allBorrowers ? {} : { '_id': { $in: user.borrowersAccess } })
|
|
16
16
|
.collation({ locale: 'en' })
|
|
@@ -30,7 +30,7 @@ import { CollateralsService } from './collaterals.service';
|
|
|
30
30
|
import { LoanStatementStatusService } from './loan-statement-status.service';
|
|
31
31
|
import { LoanTransactionsService } from './loan-transactions.service';
|
|
32
32
|
import { SignsService } from './signs.service';
|
|
33
|
-
import { IUser } from '../interfaces/auth-user.interface';
|
|
33
|
+
import { IUser, IUserAccess } from '../interfaces/auth-user.interface';
|
|
34
34
|
export declare const borrowerDataModels: {
|
|
35
35
|
[modelName: string]: mongoose.Model<any>;
|
|
36
36
|
};
|
|
@@ -40,7 +40,7 @@ export declare class BorrowerService {
|
|
|
40
40
|
private readonly getLoanTransactionsService;
|
|
41
41
|
private readonly getSignsService;
|
|
42
42
|
constructor(getCollateralsService: () => CollateralsService, getLoanStatementStatusService: () => LoanStatementStatusService, getLoanTransactionsService: () => LoanTransactionsService, getSignsService: () => SignsService);
|
|
43
|
-
isBorrowerAllowed(
|
|
43
|
+
isBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean;
|
|
44
44
|
checkBorrower(user: IUser, requestedBorrowerId: string): boolean;
|
|
45
45
|
getBorrowerById(borrowerId: string): Promise<mongoose.FlattenMaps<IBorrowerDocument> & {
|
|
46
46
|
_id: mongoose.Types.ObjectId;
|
|
@@ -39,14 +39,14 @@ class BorrowerService {
|
|
|
39
39
|
this.getLoanTransactionsService = getLoanTransactionsService;
|
|
40
40
|
this.getSignsService = getSignsService;
|
|
41
41
|
}
|
|
42
|
-
isBorrowerAllowed(
|
|
43
|
-
if (!
|
|
42
|
+
isBorrowerAllowed(userAccess, requestedBorrowerId) {
|
|
43
|
+
if (!userAccess) {
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
|
-
if (
|
|
46
|
+
if (userAccess.allBorrowers) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
-
return
|
|
49
|
+
return userAccess.borrowersAccess?.includes(requestedBorrowerId);
|
|
50
50
|
}
|
|
51
51
|
checkBorrower(user, requestedBorrowerId) {
|
|
52
52
|
const allowedBorrower = this.isBorrowerAllowed(user, requestedBorrowerId);
|
|
@@ -24,7 +24,7 @@ import { CollateralsService } from './collaterals.service';
|
|
|
24
24
|
import { LoanStatementStatusService } from './loan-statement-status.service';
|
|
25
25
|
import { LoanTransactionsService } from './loan-transactions.service';
|
|
26
26
|
import { SignsService } from './signs.service';
|
|
27
|
-
import { IUser } from '../interfaces/auth-user.interface';
|
|
27
|
+
import { IUser, IUserAccess } from '../interfaces/auth-user.interface';
|
|
28
28
|
|
|
29
29
|
export const borrowerDataModels: {
|
|
30
30
|
[modelName: string]: mongoose.Model<any>
|
|
@@ -51,14 +51,14 @@ export class BorrowerService {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
isBorrowerAllowed(
|
|
55
|
-
if (!
|
|
54
|
+
isBorrowerAllowed(userAccess: IUserAccess, requestedBorrowerId: string): boolean {
|
|
55
|
+
if (!userAccess) {
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
58
|
+
if (userAccess.allBorrowers) {
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return userAccess.borrowersAccess?.includes(requestedBorrowerId);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
checkBorrower(user: IUser, requestedBorrowerId: string): boolean {
|
|
@@ -46,9 +46,9 @@ export declare class BrokersService {
|
|
|
46
46
|
getAllProductBrokers(): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
47
47
|
_id: import("mongoose").Types.ObjectId;
|
|
48
48
|
})[]>;
|
|
49
|
-
getBorrowerBrokers(borrowerId: string): Promise<(import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
49
|
+
getBorrowerBrokers(borrowerId: string): Promise<BrokerView[] | (import("mongoose").FlattenMaps<import("../models/ProductBroker.model").IProductBrokerDoc> & {
|
|
50
50
|
_id: import("mongoose").Types.ObjectId;
|
|
51
|
-
})[]
|
|
51
|
+
})[]>;
|
|
52
52
|
getProductBrokers(productId: string): Promise<import("../models/ProductBroker.model").IProductBrokerDocWithBroker[]>;
|
|
53
53
|
getTotalShares(borrowerId: string, brokers: IProductBrokerView[], replaceNames?: boolean): Promise<ProductTotal>;
|
|
54
54
|
getTotals(borrowerId: string): Promise<BrokerTotalView[]>;
|
|
@@ -26,7 +26,7 @@ import mongoose from 'mongoose';
|
|
|
26
26
|
import { IEmailRecipient } from '../models/ComplianceItem.model';
|
|
27
27
|
import { IGroupedEmailsUpdate } from '../interfaces/email-addresses.interface';
|
|
28
28
|
import { IComplianceBorrowerDocument, IComplianceBorrowerDocumentFull } from '../models/BorrowerCompliance.model';
|
|
29
|
-
import {
|
|
29
|
+
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
30
30
|
import { FileManagerService } from './file-manager.service';
|
|
31
31
|
import { UploadsService } from './uploads.service';
|
|
32
32
|
export declare class ComplianceBorrowersService {
|
|
@@ -148,5 +148,5 @@ export declare class ComplianceBorrowersService {
|
|
|
148
148
|
toggleComplianceBorrowerVisibility(borrowerId: string, isVisible: boolean): Promise<void>;
|
|
149
149
|
createComplianceBorrower(borrowerId: string, isVisible?: boolean): Promise<void>;
|
|
150
150
|
removeIncorrectBorrowers(): Promise<void>;
|
|
151
|
-
getBorrowerListReport(user:
|
|
151
|
+
getBorrowerListReport(user: IUserAccess): Promise<any>;
|
|
152
152
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
IComplianceBorrowerDocumentFull,
|
|
12
12
|
} from '../models/BorrowerCompliance.model';
|
|
13
13
|
import { BorrowerModel } from '../models/Borrower.model';
|
|
14
|
-
import {
|
|
14
|
+
import { IUserAccess } from '../interfaces/auth-user.interface';
|
|
15
15
|
import FinancialComplianceBorrower from '../models/FinancialComplianceBorrower.model';
|
|
16
16
|
import { FileManagerService } from './file-manager.service';
|
|
17
17
|
import { UploadsService } from './uploads.service';
|
|
@@ -579,7 +579,7 @@ export class ComplianceBorrowersService {
|
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
async getBorrowerListReport(user:
|
|
582
|
+
async getBorrowerListReport(user: IUserAccess) {
|
|
583
583
|
const userFilter = user.allBorrowers
|
|
584
584
|
? { isVisible: true }
|
|
585
585
|
: { 'borrower': { $in: user.borrowersAccess }, isVisible: true };
|
|
@@ -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<{
|