gemcap-be-common 1.3.186 → 1.4.1
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/collaterals.db.d.ts +1 -1
- package/interfaces/auth-user.interface.d.ts +21 -0
- package/interfaces/auth-user.interface.ts +22 -0
- package/models/AvailabilitySigns.model.d.ts +3 -3
- package/models/AvailabilitySigns.model.ts +3 -3
- package/models/ReceivableAvailability.model.d.ts +32 -32
- package/models/ReceivableAvailability.model.ts +2 -2
- package/models/User.model.d.ts +3 -3
- package/models/User.model.ts +3 -3
- package/models/_index.d.ts +3 -3
- package/package.json +1 -1
- package/services/availability.service.d.ts +5 -5
- package/services/availability.service.ts +5 -5
- package/services/borrowers.db.d.ts +1 -1
- package/services/borrowers.db.js +1 -1
- package/services/borrowers.db.ts +2 -2
- package/services/borrowers.service.d.ts +5 -4
- package/services/borrowers.service.js +8 -5
- package/services/borrowers.service.ts +9 -5
- package/services/compliance-borrowers.service.d.ts +3 -3
- package/services/compliance-borrowers.service.ts +2 -2
- package/services/loan-payments.service.d.ts +3 -1
- package/services/loan-payments.service.js +5 -4
- package/services/loan-payments.service.ts +4 -3
- package/services/nodemailer.service.d.ts +0 -2
- package/services/nodemailer.service.js +0 -28
- package/services/nodemailer.service.ts +0 -35
- package/services/signs.service.d.ts +4 -4
- package/services/signs.service.js +2 -4
- package/services/signs.service.ts +8 -11
- package/services/term-loan.service.js +1 -0
- package/services/term-loan.service.ts +1 -0
- package/services/uploads.service.d.ts +3 -1
- package/services/uploads.service.js +4 -3
- package/services/uploads.service.ts +3 -2
- package/services/users.service.d.ts +15 -137
- package/services/users.service.js +81 -349
- package/services/users.service.ts +88 -380
- package/tsconfig.tsbuildinfo +1 -1
- package/interfaces/keycloak-role.interface.d.ts +0 -14
- package/interfaces/keycloak-role.interface.ts +0 -16
- package/interfaces/keycloak-user.interface.d.ts +0 -31
- package/interfaces/keycloak-user.interface.js +0 -2
- package/interfaces/keycloak-user.interface.ts +0 -30
- /package/interfaces/{keycloak-role.interface.js → auth-user.interface.js} +0 -0
package/db/collaterals.db.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const createQuery: (groupFields: {
|
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
77
|
itemQueries: any;
|
|
78
|
-
enumKey: "INVENTORY" | "
|
|
78
|
+
enumKey: "INVENTORY" | "OTHER" | "RECEIVABLE" | "ACCOUNT_PAYABLE" | "CASH" | "LOAN_TRANSACTIONS" | "QUICKBOOKS" | "UPLOADED_BANK_TRANSACTIONS";
|
|
79
79
|
};
|
|
80
80
|
export declare const ITEMS_PAGINATION: (paginatorOptions: IPaginatorOptions) => ({
|
|
81
81
|
$skip: number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IUserBasic {
|
|
2
|
+
id: string;
|
|
3
|
+
username: string;
|
|
4
|
+
email: string | null;
|
|
5
|
+
firstName: string | null;
|
|
6
|
+
lastName: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface IUser extends IUserBasic {
|
|
9
|
+
createdAt?: Date;
|
|
10
|
+
updatedAt?: Date;
|
|
11
|
+
passwordResetTokenHash?: string | null;
|
|
12
|
+
passwordResetExpires?: Date | null;
|
|
13
|
+
refreshTokenHash?: string | null;
|
|
14
|
+
refreshTokenExpires?: Date | null;
|
|
15
|
+
roles?: Record<string, string[]>;
|
|
16
|
+
deletedAt?: Date | null;
|
|
17
|
+
isEnabled?: boolean;
|
|
18
|
+
allBorrowers?: boolean;
|
|
19
|
+
borrowersAccess?: string[];
|
|
20
|
+
lastLogin?: Date | null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface IUserBasic {
|
|
2
|
+
id: string;
|
|
3
|
+
username: string;
|
|
4
|
+
email: string | null;
|
|
5
|
+
firstName: string | null;
|
|
6
|
+
lastName: string | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface IUser extends IUserBasic {
|
|
10
|
+
createdAt?: Date;
|
|
11
|
+
updatedAt?: Date;
|
|
12
|
+
passwordResetTokenHash?: string | null;
|
|
13
|
+
passwordResetExpires?: Date | null;
|
|
14
|
+
refreshTokenHash?: string | null;
|
|
15
|
+
refreshTokenExpires?: Date | null;
|
|
16
|
+
roles?: Record<string, string[]>;
|
|
17
|
+
deletedAt?: Date | null;
|
|
18
|
+
isEnabled?: boolean;
|
|
19
|
+
allBorrowers?: boolean;
|
|
20
|
+
borrowersAccess?: string[];
|
|
21
|
+
lastLogin?: Date | null;
|
|
22
|
+
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
|
-
import {
|
|
26
|
+
import { IUserLegacyDoc } from './User.model';
|
|
27
27
|
export declare const REQUIRED_SIGNS = 2;
|
|
28
28
|
export interface IAvailabilitySignItem {
|
|
29
29
|
userSignedId: mongoose.Types.ObjectId;
|
|
@@ -33,9 +33,9 @@ export interface IAvailabilitySignItem {
|
|
|
33
33
|
}
|
|
34
34
|
export interface IAvailabilitySignItemView {
|
|
35
35
|
_id: mongoose.Types.ObjectId;
|
|
36
|
-
userSigned:
|
|
36
|
+
userSigned: IUserLegacyDoc;
|
|
37
37
|
signedAt: Date;
|
|
38
|
-
userRevoked?:
|
|
38
|
+
userRevoked?: IUserLegacyDoc;
|
|
39
39
|
revokedAt?: Date;
|
|
40
40
|
}
|
|
41
41
|
export interface IAvailabilitySign {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { IUserLegacyDoc } from './User.model';
|
|
4
4
|
import { MODEL_NAMES } from './_models';
|
|
5
5
|
|
|
6
6
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
@@ -16,9 +16,9 @@ export interface IAvailabilitySignItem {
|
|
|
16
16
|
|
|
17
17
|
export interface IAvailabilitySignItemView {
|
|
18
18
|
_id: mongoose.Types.ObjectId;
|
|
19
|
-
userSigned:
|
|
19
|
+
userSigned: IUserLegacyDoc;
|
|
20
20
|
signedAt: Date;
|
|
21
|
-
userRevoked?:
|
|
21
|
+
userRevoked?: IUserLegacyDoc;
|
|
22
22
|
revokedAt?: Date;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from 'mongoose';
|
|
26
26
|
import { IReceivableAvailabilityItem, IReceivableAvailabilityItemView } from './ReceivableAvailabilityItem.model';
|
|
27
|
-
import {
|
|
27
|
+
import { IUserLegacyDoc } from './User.model';
|
|
28
28
|
import { SummaryMultipliers } from './ReceivableAvailabilityManualSummary.model';
|
|
29
29
|
export declare enum ELimitSettings {
|
|
30
30
|
EXCLUDED_CUSTOMERS = "excludedCustomers",
|
|
@@ -94,7 +94,7 @@ export interface IReceivableAvailabilityView extends IReceivableAvailabilityDoc
|
|
|
94
94
|
items: IReceivableAvailabilityItemView[];
|
|
95
95
|
uniqueCustomers: string[];
|
|
96
96
|
totalItems: number;
|
|
97
|
-
userCalculated?:
|
|
97
|
+
userCalculated?: IUserLegacyDoc;
|
|
98
98
|
}
|
|
99
99
|
export declare const summarySchemeDesc: {
|
|
100
100
|
invoiceAmount: {
|
|
@@ -190,43 +190,43 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
190
190
|
__v?: number;
|
|
191
191
|
summary?: {
|
|
192
192
|
invoiceAmount: number;
|
|
193
|
-
|
|
194
|
-
excludedCustomerDeduction: number;
|
|
193
|
+
ARReserves: number;
|
|
195
194
|
grossAR: number;
|
|
195
|
+
balanceAfterCrossAge: number;
|
|
196
196
|
permittedOver: number;
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
creditNotes: number;
|
|
198
|
+
excludedCustomerDeduction: number;
|
|
199
199
|
deduction: number;
|
|
200
200
|
partiallyPaidDeduction: number;
|
|
201
201
|
contraDeduction: number;
|
|
202
202
|
crossAgeDeduction: number;
|
|
203
203
|
waivedDeduction: number;
|
|
204
|
-
balanceAfterCrossAge: number;
|
|
205
204
|
finalResult: number;
|
|
206
205
|
insuredComponent: number;
|
|
206
|
+
preliminaryEligibleBalance: number;
|
|
207
207
|
uninsuredComponent: number;
|
|
208
208
|
insuredAvailability: number;
|
|
209
209
|
uninsuredAvailability: number;
|
|
210
|
-
|
|
210
|
+
creditNotesNegative: number;
|
|
211
211
|
ARAvailability: number;
|
|
212
212
|
};
|
|
213
|
-
actual?: boolean;
|
|
214
213
|
userCalculatedId?: mongoose.Types.ObjectId;
|
|
215
214
|
calculatedAt?: Date;
|
|
215
|
+
actual?: boolean;
|
|
216
216
|
settings?: {
|
|
217
217
|
excludedCustomers: mongoose.Types.DocumentArray<{
|
|
218
218
|
limit?: number;
|
|
219
219
|
customer?: string;
|
|
220
220
|
}>;
|
|
221
|
-
|
|
221
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
222
222
|
limit?: number;
|
|
223
223
|
customer?: string;
|
|
224
224
|
}>;
|
|
225
|
-
|
|
225
|
+
permittedExtendedARDays: mongoose.Types.DocumentArray<{
|
|
226
226
|
limit?: number;
|
|
227
227
|
customer?: string;
|
|
228
228
|
}>;
|
|
229
|
-
|
|
229
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
230
230
|
limit?: number;
|
|
231
231
|
customer?: string;
|
|
232
232
|
}>;
|
|
@@ -250,43 +250,43 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
250
250
|
__v?: number;
|
|
251
251
|
summary?: {
|
|
252
252
|
invoiceAmount: number;
|
|
253
|
-
|
|
254
|
-
excludedCustomerDeduction: number;
|
|
253
|
+
ARReserves: number;
|
|
255
254
|
grossAR: number;
|
|
255
|
+
balanceAfterCrossAge: number;
|
|
256
256
|
permittedOver: number;
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
creditNotes: number;
|
|
258
|
+
excludedCustomerDeduction: number;
|
|
259
259
|
deduction: number;
|
|
260
260
|
partiallyPaidDeduction: number;
|
|
261
261
|
contraDeduction: number;
|
|
262
262
|
crossAgeDeduction: number;
|
|
263
263
|
waivedDeduction: number;
|
|
264
|
-
balanceAfterCrossAge: number;
|
|
265
264
|
finalResult: number;
|
|
266
265
|
insuredComponent: number;
|
|
266
|
+
preliminaryEligibleBalance: number;
|
|
267
267
|
uninsuredComponent: number;
|
|
268
268
|
insuredAvailability: number;
|
|
269
269
|
uninsuredAvailability: number;
|
|
270
|
-
|
|
270
|
+
creditNotesNegative: number;
|
|
271
271
|
ARAvailability: number;
|
|
272
272
|
};
|
|
273
|
-
actual?: boolean;
|
|
274
273
|
userCalculatedId?: mongoose.Types.ObjectId;
|
|
275
274
|
calculatedAt?: Date;
|
|
275
|
+
actual?: boolean;
|
|
276
276
|
settings?: {
|
|
277
277
|
excludedCustomers: mongoose.Types.DocumentArray<{
|
|
278
278
|
limit?: number;
|
|
279
279
|
customer?: string;
|
|
280
280
|
}>;
|
|
281
|
-
|
|
281
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
282
282
|
limit?: number;
|
|
283
283
|
customer?: string;
|
|
284
284
|
}>;
|
|
285
|
-
|
|
285
|
+
permittedExtendedARDays: mongoose.Types.DocumentArray<{
|
|
286
286
|
limit?: number;
|
|
287
287
|
customer?: string;
|
|
288
288
|
}>;
|
|
289
|
-
|
|
289
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
290
290
|
limit?: number;
|
|
291
291
|
customer?: string;
|
|
292
292
|
}>;
|
|
@@ -310,43 +310,43 @@ export declare const AvailabilitySchema: mongoose.Schema<any, mongoose.Model<any
|
|
|
310
310
|
__v?: number;
|
|
311
311
|
summary?: {
|
|
312
312
|
invoiceAmount: number;
|
|
313
|
-
|
|
314
|
-
excludedCustomerDeduction: number;
|
|
313
|
+
ARReserves: number;
|
|
315
314
|
grossAR: number;
|
|
315
|
+
balanceAfterCrossAge: number;
|
|
316
316
|
permittedOver: number;
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
creditNotes: number;
|
|
318
|
+
excludedCustomerDeduction: number;
|
|
319
319
|
deduction: number;
|
|
320
320
|
partiallyPaidDeduction: number;
|
|
321
321
|
contraDeduction: number;
|
|
322
322
|
crossAgeDeduction: number;
|
|
323
323
|
waivedDeduction: number;
|
|
324
|
-
balanceAfterCrossAge: number;
|
|
325
324
|
finalResult: number;
|
|
326
325
|
insuredComponent: number;
|
|
326
|
+
preliminaryEligibleBalance: number;
|
|
327
327
|
uninsuredComponent: number;
|
|
328
328
|
insuredAvailability: number;
|
|
329
329
|
uninsuredAvailability: number;
|
|
330
|
-
|
|
330
|
+
creditNotesNegative: number;
|
|
331
331
|
ARAvailability: number;
|
|
332
332
|
};
|
|
333
|
-
actual?: boolean;
|
|
334
333
|
userCalculatedId?: mongoose.Types.ObjectId;
|
|
335
334
|
calculatedAt?: Date;
|
|
335
|
+
actual?: boolean;
|
|
336
336
|
settings?: {
|
|
337
337
|
excludedCustomers: mongoose.Types.DocumentArray<{
|
|
338
338
|
limit?: number;
|
|
339
339
|
customer?: string;
|
|
340
340
|
}>;
|
|
341
|
-
|
|
341
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
342
342
|
limit?: number;
|
|
343
343
|
customer?: string;
|
|
344
344
|
}>;
|
|
345
|
-
|
|
345
|
+
permittedExtendedARDays: mongoose.Types.DocumentArray<{
|
|
346
346
|
limit?: number;
|
|
347
347
|
customer?: string;
|
|
348
348
|
}>;
|
|
349
|
-
|
|
349
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
350
350
|
limit?: number;
|
|
351
351
|
customer?: string;
|
|
352
352
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose, { Document } from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { IReceivableAvailabilityItem, IReceivableAvailabilityItemView } from './ReceivableAvailabilityItem.model';
|
|
4
|
-
import {
|
|
4
|
+
import { IUserLegacyDoc } from './User.model';
|
|
5
5
|
import { MODEL_NAMES } from './_models';
|
|
6
6
|
import { SummaryMultipliers } from './ReceivableAvailabilityManualSummary.model';
|
|
7
7
|
|
|
@@ -83,7 +83,7 @@ export interface IReceivableAvailabilityView extends IReceivableAvailabilityDoc
|
|
|
83
83
|
items: IReceivableAvailabilityItemView[];
|
|
84
84
|
uniqueCustomers: string[];
|
|
85
85
|
totalItems: number;
|
|
86
|
-
userCalculated?:
|
|
86
|
+
userCalculated?: IUserLegacyDoc;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export const summarySchemeDesc = {
|
package/models/User.model.d.ts
CHANGED
|
@@ -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
|
-
export interface
|
|
26
|
+
export interface IUserLegacy {
|
|
27
27
|
isDeleted?: boolean;
|
|
28
28
|
firstName?: string;
|
|
29
29
|
lastName?: string;
|
|
@@ -34,7 +34,7 @@ export interface IUser {
|
|
|
34
34
|
borrower: string;
|
|
35
35
|
}[];
|
|
36
36
|
}
|
|
37
|
-
export interface
|
|
37
|
+
export interface IUserLegacyDoc extends IUserLegacy, Document {
|
|
38
38
|
}
|
|
39
39
|
export declare const UserSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
40
40
|
timestamps: true;
|
|
@@ -83,4 +83,4 @@ export declare const UserSchema: mongoose.Schema<any, mongoose.Model<any, any, a
|
|
|
83
83
|
}> & {
|
|
84
84
|
_id: mongoose.Types.ObjectId;
|
|
85
85
|
}>;
|
|
86
|
-
export declare const UserModel: mongoose.Model<
|
|
86
|
+
export declare const UserModel: mongoose.Model<IUserLegacyDoc>;
|
package/models/User.model.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { MODEL_NAMES } from './_models';
|
|
|
4
4
|
|
|
5
5
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface IUserLegacy {
|
|
8
8
|
isDeleted?: boolean;
|
|
9
9
|
firstName?: string;
|
|
10
10
|
lastName?: string;
|
|
@@ -16,7 +16,7 @@ export interface IUser {
|
|
|
16
16
|
}[];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export interface
|
|
19
|
+
export interface IUserLegacyDoc extends IUserLegacy, Document {
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const UserSchema = new mongoose.Schema(
|
|
@@ -63,4 +63,4 @@ export const UserSchema = new mongoose.Schema(
|
|
|
63
63
|
|
|
64
64
|
UserSchema.plugin(mongooseLeanId);
|
|
65
65
|
|
|
66
|
-
export const UserModel: mongoose.Model<
|
|
66
|
+
export const UserModel: mongoose.Model<IUserLegacyDoc> = mongoose.model<IUserLegacyDoc>(MODEL_NAMES.users, UserSchema);
|
package/models/_index.d.ts
CHANGED
|
@@ -32,9 +32,9 @@ export declare const allSchemas: {
|
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
34
|
order: number;
|
|
35
|
+
amount: number;
|
|
35
36
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
36
37
|
apDate: Date;
|
|
37
|
-
amount: number;
|
|
38
38
|
__v?: number;
|
|
39
39
|
poNumber?: string;
|
|
40
40
|
customerName?: string;
|
|
@@ -46,9 +46,9 @@ export declare const allSchemas: {
|
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
48
|
order: number;
|
|
49
|
+
amount: number;
|
|
49
50
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
50
51
|
apDate: Date;
|
|
51
|
-
amount: number;
|
|
52
52
|
__v?: number;
|
|
53
53
|
poNumber?: string;
|
|
54
54
|
customerName?: string;
|
|
@@ -60,9 +60,9 @@ export declare const allSchemas: {
|
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
62
|
order: number;
|
|
63
|
+
amount: number;
|
|
63
64
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
64
65
|
apDate: Date;
|
|
65
|
-
amount: number;
|
|
66
66
|
__v?: number;
|
|
67
67
|
poNumber?: string;
|
|
68
68
|
customerName?: string;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ELimitSettings, IReceivableAvailability, IAvailabilityLimits, IAvailabilitySettings, IAvailabilitySummary, IReceivableAvailabilityView } from '../models/ReceivableAvailability.model';
|
|
2
|
-
import {
|
|
2
|
+
import { IUserLegacyDoc } from '../models/User.model';
|
|
3
3
|
import { IReceivableAvailabilityItemView } from '../models/ReceivableAvailabilityItem.model';
|
|
4
4
|
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
5
5
|
import { IInventoryAvailabilitySummary, InventoryAvailabilityPaginators } from '../models/InventoryAvailability.model';
|
|
@@ -49,14 +49,14 @@ export declare class AvailabilityService {
|
|
|
49
49
|
private readonly signsService;
|
|
50
50
|
constructor(collateralAdjustmentsService: CollateralAdjustmentsService, collateralsService: CollateralsService, equipmentService: EquipmentService, inventoryAvailabilityService: InventoryAvailabilityService, loanStatementService: LoanStatementService, loanTransactionsService: LoanTransactionsService, manualEntryService: ManualEntryService, reserveService: ReserveService, signsService: SignsService);
|
|
51
51
|
recombineGroups(calculationsSettings: IAvailabilitySettings): Promise<IMappedSettings>;
|
|
52
|
-
calculateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
53
|
-
getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
52
|
+
calculateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUserLegacyDoc): Promise<IReceivableAvailabilityView>;
|
|
53
|
+
getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUserLegacyDoc): Promise<IReceivableAvailabilityView>;
|
|
54
54
|
getAvailabilityItemsWithFilter(bbcDateId: string, itemsFilter: string): Promise<{
|
|
55
55
|
itemsFilter: any;
|
|
56
56
|
invoiceItems: any[];
|
|
57
57
|
customerItems: any[];
|
|
58
58
|
}>;
|
|
59
|
-
foundOrCreateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
59
|
+
foundOrCreateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUserLegacyDoc): Promise<IReceivableAvailabilityView>;
|
|
60
60
|
findCalculatedAvailability(bbcDateId: string): Promise<IReceivableAvailabilityView>;
|
|
61
61
|
saveCalculatedAvailabilitySettings(bbcDateId: string, settings: IAvailabilitySettings): Promise<void>;
|
|
62
62
|
saveLimitSettings(bbcDateId: string, limitSettings: {
|
|
@@ -70,7 +70,7 @@ export declare class AvailabilityService {
|
|
|
70
70
|
getUniqueCustomers(availabilityId: string): Promise<{
|
|
71
71
|
customerTitle: string;
|
|
72
72
|
}[]>;
|
|
73
|
-
getAllSummaries(bbcDateId: string, user:
|
|
73
|
+
getAllSummaries(bbcDateId: string, user: IUserLegacyDoc): Promise<IAvailabilityFullSummary>;
|
|
74
74
|
isBBCEditable(bbcDateId: string): Promise<boolean>;
|
|
75
75
|
toggleManualReceivableAvailability(bbcDateId: string, useManualInputs: boolean): Promise<void>;
|
|
76
76
|
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
IAvailabilitySummary,
|
|
15
15
|
IReceivableAvailabilityView,
|
|
16
16
|
} from '../models/ReceivableAvailability.model';
|
|
17
|
-
import {
|
|
17
|
+
import { IUserLegacyDoc } from '../models/User.model';
|
|
18
18
|
import { roundToXDigits } from '../helpers/numbers.helper';
|
|
19
19
|
import { AccountPayableItemModel } from '../models/AccountPayableItem.model';
|
|
20
20
|
import { ECollaterals } from '../enums/collaterals.enum';
|
|
@@ -151,7 +151,7 @@ export class AvailabilityService {
|
|
|
151
151
|
return groupedSettings;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
async calculateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
154
|
+
async calculateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUserLegacyDoc): Promise<IReceivableAvailabilityView> {
|
|
155
155
|
|
|
156
156
|
const calculationsSettings = await this.getCalculationSettings(bbcDateId);
|
|
157
157
|
|
|
@@ -560,7 +560,7 @@ export class AvailabilityService {
|
|
|
560
560
|
return await this.getAvailability(bbcDateId, paginatorOptions, user);
|
|
561
561
|
}
|
|
562
562
|
|
|
563
|
-
async getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
563
|
+
async getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUserLegacyDoc) {
|
|
564
564
|
return await this.foundOrCreateAvailability(bbcDateId, paginatorOptions, user);
|
|
565
565
|
}
|
|
566
566
|
|
|
@@ -655,7 +655,7 @@ export class AvailabilityService {
|
|
|
655
655
|
return { itemsFilter: filterField, invoiceItems, customerItems: customerItemsWithTotal };
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
-
async foundOrCreateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
658
|
+
async foundOrCreateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUserLegacyDoc) {
|
|
659
659
|
const foundAvailability = await this.findCalculatedAvailability(bbcDateId);
|
|
660
660
|
if (foundAvailability) {
|
|
661
661
|
foundAvailability.items = await this.getAvailabilityItems(foundAvailability._id.toString(), paginatorOptions);
|
|
@@ -989,7 +989,7 @@ export class AvailabilityService {
|
|
|
989
989
|
]);
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
-
async getAllSummaries(bbcDateId: string, user:
|
|
992
|
+
async getAllSummaries(bbcDateId: string, user: IUserLegacyDoc): Promise<IAvailabilityFullSummary> {
|
|
993
993
|
const equipment = await this.equipmentService.getEquipmentForBBC(bbcDateId);
|
|
994
994
|
const reserve = await this.reserveService.getReserve(bbcDateId);
|
|
995
995
|
const loanBalances = await this.loanTransactionsService.getLoanBalanceForBBCDateId(bbcDateId);
|
|
@@ -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 { IUser } from '../
|
|
26
|
+
import { IUser } 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;
|
package/services/borrowers.db.js
CHANGED
|
@@ -11,7 +11,7 @@ class BorrowersDB {
|
|
|
11
11
|
}
|
|
12
12
|
async getAllowedBorrowers(user) {
|
|
13
13
|
return Borrower_model_1.BorrowerModel
|
|
14
|
-
.find(user.allBorrowers ? {} : { '_id': { $in: user.borrowersAccess
|
|
14
|
+
.find(user.allBorrowers ? {} : { '_id': { $in: user.borrowersAccess } })
|
|
15
15
|
.collation({ locale: 'en' })
|
|
16
16
|
.sort({ code: 1 })
|
|
17
17
|
.lean();
|
package/services/borrowers.db.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BorrowerModel } from '../models/Borrower.model';
|
|
2
|
-
import { IUser } from '../
|
|
2
|
+
import { IUser } from '../interfaces/auth-user.interface';
|
|
3
3
|
|
|
4
4
|
export class BorrowersDB {
|
|
5
5
|
async getAllBorrowers() {
|
|
@@ -12,7 +12,7 @@ export class BorrowersDB {
|
|
|
12
12
|
|
|
13
13
|
async getAllowedBorrowers(user: IUser) {
|
|
14
14
|
return BorrowerModel
|
|
15
|
-
.find(user.allBorrowers ? {} : { '_id': { $in: user.borrowersAccess
|
|
15
|
+
.find(user.allBorrowers ? {} : { '_id': { $in: user.borrowersAccess } })
|
|
16
16
|
.collation({ locale: 'en' })
|
|
17
17
|
.sort({ code: 1 })
|
|
18
18
|
.lean();
|
|
@@ -30,6 +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
34
|
export declare const borrowerDataModels: {
|
|
34
35
|
[modelName: string]: mongoose.Model<any>;
|
|
35
36
|
};
|
|
@@ -39,8 +40,8 @@ export declare class BorrowerService {
|
|
|
39
40
|
private readonly getLoanTransactionsService;
|
|
40
41
|
private readonly getSignsService;
|
|
41
42
|
constructor(getCollateralsService: () => CollateralsService, getLoanStatementStatusService: () => LoanStatementStatusService, getLoanTransactionsService: () => LoanTransactionsService, getSignsService: () => SignsService);
|
|
42
|
-
isBorrowerAllowed(
|
|
43
|
-
checkBorrower(
|
|
43
|
+
isBorrowerAllowed(user: IUser, requestedBorrowerId: string): boolean;
|
|
44
|
+
checkBorrower(user: IUser, requestedBorrowerId: string): boolean;
|
|
44
45
|
getBorrowerById(borrowerId: string): Promise<mongoose.FlattenMaps<IBorrowerDocument> & {
|
|
45
46
|
_id: mongoose.Types.ObjectId;
|
|
46
47
|
}>;
|
|
@@ -83,10 +84,10 @@ export declare class BorrowerService {
|
|
|
83
84
|
getBorrowerCodesMap(): Promise<Map<string, string>>;
|
|
84
85
|
getBorrowerStatementDetails(borrowers: IBorrowerDocument[]): Promise<{
|
|
85
86
|
[x: number]: {
|
|
86
|
-
SELECTED_PERIOD?: boolean;
|
|
87
|
-
ENTIRE_LOAN?: boolean;
|
|
88
87
|
LAST_MONTH?: boolean;
|
|
89
88
|
CURRENT_MONTH?: boolean;
|
|
89
|
+
ENTIRE_LOAN?: boolean;
|
|
90
|
+
SELECTED_PERIOD?: boolean;
|
|
90
91
|
TERM_LOAN?: boolean;
|
|
91
92
|
};
|
|
92
93
|
}>;
|
|
@@ -39,14 +39,17 @@ class BorrowerService {
|
|
|
39
39
|
this.getLoanTransactionsService = getLoanTransactionsService;
|
|
40
40
|
this.getSignsService = getSignsService;
|
|
41
41
|
}
|
|
42
|
-
isBorrowerAllowed(
|
|
43
|
-
if (
|
|
42
|
+
isBorrowerAllowed(user, requestedBorrowerId) {
|
|
43
|
+
if (!user) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (user.allBorrowers) {
|
|
44
47
|
return true;
|
|
45
48
|
}
|
|
46
|
-
return
|
|
49
|
+
return user.borrowersAccess?.includes(requestedBorrowerId);
|
|
47
50
|
}
|
|
48
|
-
checkBorrower(
|
|
49
|
-
const allowedBorrower = this.isBorrowerAllowed(
|
|
51
|
+
checkBorrower(user, requestedBorrowerId) {
|
|
52
|
+
const allowedBorrower = this.isBorrowerAllowed(user, requestedBorrowerId);
|
|
50
53
|
if (!allowedBorrower) {
|
|
51
54
|
throw new Error('Non allowed borrower');
|
|
52
55
|
}
|
|
@@ -24,6 +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
28
|
|
|
28
29
|
export const borrowerDataModels: {
|
|
29
30
|
[modelName: string]: mongoose.Model<any>
|
|
@@ -50,15 +51,18 @@ export class BorrowerService {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
isBorrowerAllowed(
|
|
54
|
-
if (
|
|
54
|
+
isBorrowerAllowed(user: IUser, requestedBorrowerId: string): boolean {
|
|
55
|
+
if (!user) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (user.allBorrowers) {
|
|
55
59
|
return true;
|
|
56
60
|
}
|
|
57
|
-
return
|
|
61
|
+
return user.borrowersAccess?.includes(requestedBorrowerId);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
checkBorrower(
|
|
61
|
-
const allowedBorrower = this.isBorrowerAllowed(
|
|
64
|
+
checkBorrower(user: IUser, requestedBorrowerId: string): boolean {
|
|
65
|
+
const allowedBorrower = this.isBorrowerAllowed(user, requestedBorrowerId);
|
|
62
66
|
if (!allowedBorrower) {
|
|
63
67
|
throw new Error('Non allowed borrower');
|
|
64
68
|
}
|
|
@@ -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 { IUserLegacy } from '../models/User.model';
|
|
30
30
|
import { FileManagerService } from './file-manager.service';
|
|
31
31
|
import { UploadsService } from './uploads.service';
|
|
32
32
|
export declare class ComplianceBorrowersService {
|
|
@@ -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, "borrower" | "
|
|
48
|
+
getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "borrower" | "items" | "fundingStatus"> | {
|
|
49
49
|
items: {
|
|
50
50
|
instances: any[];
|
|
51
51
|
item: import("../models/ComplianceItem.model").IComplianceItemDocument;
|
|
@@ -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: IUserLegacy): 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 { IUserLegacy } from '../models/User.model';
|
|
15
15
|
|
|
16
16
|
import FinancialComplianceBorrower from '../models/FinancialComplianceBorrower.model';
|
|
17
17
|
import { FileManagerService } from './file-manager.service';
|
|
@@ -580,7 +580,7 @@ export class ComplianceBorrowersService {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
-
async getBorrowerListReport(user:
|
|
583
|
+
async getBorrowerListReport(user: IUserLegacy) {
|
|
584
584
|
const userFilter = user.allBorrowers
|
|
585
585
|
? { isVisible: true }
|
|
586
586
|
: { 'borrower': { $in: user.borrowersAccess.map((b) => b.borrower) }, isVisible: true };
|
|
@@ -37,6 +37,7 @@ import { LoanStatementStatusService } from './loan-statement-status.service';
|
|
|
37
37
|
import { LoanTransactionsService } from './loan-transactions.service';
|
|
38
38
|
import { TermLoanService } from './term-loan.service';
|
|
39
39
|
import { LockService } from './lock.service';
|
|
40
|
+
import { UsersService } from './users.service';
|
|
40
41
|
export declare const paymentOrder: ELoanChargeType[];
|
|
41
42
|
export declare class LoanPaymentsService {
|
|
42
43
|
private readonly redisClient;
|
|
@@ -50,7 +51,8 @@ export declare class LoanPaymentsService {
|
|
|
50
51
|
private readonly loanTransactionsService;
|
|
51
52
|
private readonly lockService;
|
|
52
53
|
private readonly termLoanService;
|
|
53
|
-
|
|
54
|
+
private readonly usersService;
|
|
55
|
+
constructor(redisClient: RedisClientType, borrowersDB: BorrowersDB, financialComplianceService: FinancialComplianceService, loanChargesService: LoanChargesService, loanProductsService: LoanProductsService, loanStatementBalanceService: LoanStatementBalanceService, getLoanStatementService: () => LoanStatementService, loanStatementStatusService: LoanStatementStatusService, loanTransactionsService: LoanTransactionsService, lockService: LockService, termLoanService: TermLoanService, usersService: UsersService);
|
|
54
56
|
getLoanPayment(paymentId: string): Promise<mongoose.FlattenMaps<ILoanPaymentDoc> & {
|
|
55
57
|
_id: mongoose.Types.ObjectId;
|
|
56
58
|
}>;
|