gemcap-be-common 1.4.1 → 1.4.2
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/models/AvailabilitySigns.model.d.ts +11 -11
- package/models/AvailabilitySigns.model.js +2 -4
- package/models/AvailabilitySigns.model.ts +7 -9
- package/models/ReceivableAvailability.model.d.ts +32 -32
- package/models/ReceivableAvailability.model.ts +2 -2
- package/models/_index.d.ts +6 -6
- package/package.json +1 -1
- package/services/availability.service.d.ts +5 -5
- package/services/availability.service.js +1 -1
- package/services/availability.service.ts +6 -7
- package/services/compliance-borrowers.service.d.ts +3 -3
- package/services/compliance-borrowers.service.js +1 -1
- package/services/compliance-borrowers.service.ts +3 -4
- package/services/signs.service.d.ts +2 -3
- package/services/signs.service.js +8 -9
- package/services/signs.service.ts +11 -13
- package/services/users.service.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
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" | "RECEIVABLE" | "ACCOUNT_PAYABLE" | "OTHER" | "CASH" | "LOAN_TRANSACTIONS" | "QUICKBOOKS" | "UPLOADED_BANK_TRANSACTIONS";
|
|
79
79
|
};
|
|
80
80
|
export declare const ITEMS_PAGINATION: (paginatorOptions: IPaginatorOptions) => ({
|
|
81
81
|
$skip: number;
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
|
-
import {
|
|
26
|
+
import { IUser } from '../interfaces/auth-user.interface';
|
|
27
27
|
export declare const REQUIRED_SIGNS = 2;
|
|
28
28
|
export interface IAvailabilitySignItem {
|
|
29
|
-
userSignedId:
|
|
29
|
+
userSignedId: string;
|
|
30
30
|
signedAt: Date;
|
|
31
|
-
userRevokedId?:
|
|
31
|
+
userRevokedId?: string;
|
|
32
32
|
revokedAt?: Date;
|
|
33
33
|
}
|
|
34
34
|
export interface IAvailabilitySignItemView {
|
|
35
35
|
_id: mongoose.Types.ObjectId;
|
|
36
|
-
userSigned:
|
|
36
|
+
userSigned: IUser;
|
|
37
37
|
signedAt: Date;
|
|
38
|
-
userRevoked?:
|
|
38
|
+
userRevoked?: IUser;
|
|
39
39
|
revokedAt?: Date;
|
|
40
40
|
}
|
|
41
41
|
export interface IAvailabilitySign {
|
|
@@ -60,9 +60,9 @@ export declare const IAvailabilitySignSchema: mongoose.Schema<any, mongoose.Mode
|
|
|
60
60
|
bbcDateId: mongoose.Types.ObjectId;
|
|
61
61
|
requiredSigns: number;
|
|
62
62
|
signs: mongoose.Types.DocumentArray<{
|
|
63
|
-
userSignedId:
|
|
63
|
+
userSignedId: string;
|
|
64
64
|
signedAt: Date;
|
|
65
|
-
userRevokedId?:
|
|
65
|
+
userRevokedId?: string;
|
|
66
66
|
revokedAt?: Date;
|
|
67
67
|
}>;
|
|
68
68
|
__v?: number;
|
|
@@ -73,9 +73,9 @@ export declare const IAvailabilitySignSchema: mongoose.Schema<any, mongoose.Mode
|
|
|
73
73
|
bbcDateId: mongoose.Types.ObjectId;
|
|
74
74
|
requiredSigns: number;
|
|
75
75
|
signs: mongoose.Types.DocumentArray<{
|
|
76
|
-
userSignedId:
|
|
76
|
+
userSignedId: string;
|
|
77
77
|
signedAt: Date;
|
|
78
|
-
userRevokedId?:
|
|
78
|
+
userRevokedId?: string;
|
|
79
79
|
revokedAt?: Date;
|
|
80
80
|
}>;
|
|
81
81
|
__v?: number;
|
|
@@ -86,9 +86,9 @@ export declare const IAvailabilitySignSchema: mongoose.Schema<any, mongoose.Mode
|
|
|
86
86
|
bbcDateId: mongoose.Types.ObjectId;
|
|
87
87
|
requiredSigns: number;
|
|
88
88
|
signs: mongoose.Types.DocumentArray<{
|
|
89
|
-
userSignedId:
|
|
89
|
+
userSignedId: string;
|
|
90
90
|
signedAt: Date;
|
|
91
|
-
userRevokedId?:
|
|
91
|
+
userRevokedId?: string;
|
|
92
92
|
revokedAt?: Date;
|
|
93
93
|
}>;
|
|
94
94
|
__v?: number;
|
|
@@ -22,8 +22,7 @@ exports.IAvailabilitySignSchema = new mongoose_1.default.Schema({
|
|
|
22
22
|
signs: [
|
|
23
23
|
{
|
|
24
24
|
userSignedId: {
|
|
25
|
-
type:
|
|
26
|
-
ref: _models_1.MODEL_NAMES.users,
|
|
25
|
+
type: String,
|
|
27
26
|
required: true,
|
|
28
27
|
},
|
|
29
28
|
signedAt: {
|
|
@@ -31,8 +30,7 @@ exports.IAvailabilitySignSchema = new mongoose_1.default.Schema({
|
|
|
31
30
|
required: true,
|
|
32
31
|
},
|
|
33
32
|
userRevokedId: {
|
|
34
|
-
type:
|
|
35
|
-
ref: _models_1.MODEL_NAMES.users,
|
|
33
|
+
type: String,
|
|
36
34
|
required: false,
|
|
37
35
|
},
|
|
38
36
|
revokedAt: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { IUser } from '../interfaces/auth-user.interface';
|
|
4
4
|
import { MODEL_NAMES } from './_models';
|
|
5
5
|
|
|
6
6
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
@@ -8,17 +8,17 @@ const mongooseLeanId = require('../plugins/id.plugin');
|
|
|
8
8
|
export const REQUIRED_SIGNS = 2;
|
|
9
9
|
|
|
10
10
|
export interface IAvailabilitySignItem {
|
|
11
|
-
userSignedId:
|
|
11
|
+
userSignedId: string;
|
|
12
12
|
signedAt: Date;
|
|
13
|
-
userRevokedId?:
|
|
13
|
+
userRevokedId?: string;
|
|
14
14
|
revokedAt?: Date;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface IAvailabilitySignItemView {
|
|
18
18
|
_id: mongoose.Types.ObjectId;
|
|
19
|
-
userSigned:
|
|
19
|
+
userSigned: IUser;
|
|
20
20
|
signedAt: Date;
|
|
21
|
-
userRevoked?:
|
|
21
|
+
userRevoked?: IUser;
|
|
22
22
|
revokedAt?: Date;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -53,8 +53,7 @@ export const IAvailabilitySignSchema = new mongoose.Schema(
|
|
|
53
53
|
signs: [
|
|
54
54
|
{
|
|
55
55
|
userSignedId: {
|
|
56
|
-
type:
|
|
57
|
-
ref: MODEL_NAMES.users,
|
|
56
|
+
type: String,
|
|
58
57
|
required: true,
|
|
59
58
|
},
|
|
60
59
|
signedAt: {
|
|
@@ -62,8 +61,7 @@ export const IAvailabilitySignSchema = new mongoose.Schema(
|
|
|
62
61
|
required: true,
|
|
63
62
|
},
|
|
64
63
|
userRevokedId: {
|
|
65
|
-
type:
|
|
66
|
-
ref: MODEL_NAMES.users,
|
|
64
|
+
type: String,
|
|
67
65
|
required: false,
|
|
68
66
|
},
|
|
69
67
|
revokedAt: {
|
|
@@ -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 { IUser } from '../interfaces/auth-user.interface';
|
|
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?: IUser;
|
|
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
|
-
ARReserves: number;
|
|
194
|
-
grossAR: number;
|
|
195
|
-
balanceAfterCrossAge: number;
|
|
196
|
-
permittedOver: number;
|
|
197
193
|
creditNotes: number;
|
|
198
194
|
excludedCustomerDeduction: number;
|
|
195
|
+
grossAR: number;
|
|
196
|
+
permittedOver: number;
|
|
197
|
+
preliminaryEligibleBalance: number;
|
|
198
|
+
creditNotesNegative: number;
|
|
199
199
|
deduction: number;
|
|
200
200
|
partiallyPaidDeduction: number;
|
|
201
201
|
contraDeduction: number;
|
|
202
202
|
crossAgeDeduction: number;
|
|
203
203
|
waivedDeduction: number;
|
|
204
|
+
balanceAfterCrossAge: number;
|
|
204
205
|
finalResult: number;
|
|
205
206
|
insuredComponent: number;
|
|
206
|
-
preliminaryEligibleBalance: number;
|
|
207
207
|
uninsuredComponent: number;
|
|
208
208
|
insuredAvailability: number;
|
|
209
209
|
uninsuredAvailability: number;
|
|
210
|
-
|
|
210
|
+
ARReserves: number;
|
|
211
211
|
ARAvailability: number;
|
|
212
212
|
};
|
|
213
|
+
actual?: boolean;
|
|
213
214
|
userCalculatedId?: mongoose.Types.ObjectId;
|
|
214
215
|
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
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
222
222
|
limit?: number;
|
|
223
223
|
customer?: string;
|
|
224
224
|
}>;
|
|
225
|
-
|
|
225
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
226
226
|
limit?: number;
|
|
227
227
|
customer?: string;
|
|
228
228
|
}>;
|
|
229
|
-
|
|
229
|
+
permittedExtendedARDays: 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
|
-
ARReserves: number;
|
|
254
|
-
grossAR: number;
|
|
255
|
-
balanceAfterCrossAge: number;
|
|
256
|
-
permittedOver: number;
|
|
257
253
|
creditNotes: number;
|
|
258
254
|
excludedCustomerDeduction: number;
|
|
255
|
+
grossAR: number;
|
|
256
|
+
permittedOver: number;
|
|
257
|
+
preliminaryEligibleBalance: number;
|
|
258
|
+
creditNotesNegative: number;
|
|
259
259
|
deduction: number;
|
|
260
260
|
partiallyPaidDeduction: number;
|
|
261
261
|
contraDeduction: number;
|
|
262
262
|
crossAgeDeduction: number;
|
|
263
263
|
waivedDeduction: number;
|
|
264
|
+
balanceAfterCrossAge: number;
|
|
264
265
|
finalResult: number;
|
|
265
266
|
insuredComponent: number;
|
|
266
|
-
preliminaryEligibleBalance: number;
|
|
267
267
|
uninsuredComponent: number;
|
|
268
268
|
insuredAvailability: number;
|
|
269
269
|
uninsuredAvailability: number;
|
|
270
|
-
|
|
270
|
+
ARReserves: number;
|
|
271
271
|
ARAvailability: number;
|
|
272
272
|
};
|
|
273
|
+
actual?: boolean;
|
|
273
274
|
userCalculatedId?: mongoose.Types.ObjectId;
|
|
274
275
|
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
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
282
282
|
limit?: number;
|
|
283
283
|
customer?: string;
|
|
284
284
|
}>;
|
|
285
|
-
|
|
285
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
286
286
|
limit?: number;
|
|
287
287
|
customer?: string;
|
|
288
288
|
}>;
|
|
289
|
-
|
|
289
|
+
permittedExtendedARDays: 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
|
-
ARReserves: number;
|
|
314
|
-
grossAR: number;
|
|
315
|
-
balanceAfterCrossAge: number;
|
|
316
|
-
permittedOver: number;
|
|
317
313
|
creditNotes: number;
|
|
318
314
|
excludedCustomerDeduction: number;
|
|
315
|
+
grossAR: number;
|
|
316
|
+
permittedOver: number;
|
|
317
|
+
preliminaryEligibleBalance: number;
|
|
318
|
+
creditNotesNegative: number;
|
|
319
319
|
deduction: number;
|
|
320
320
|
partiallyPaidDeduction: number;
|
|
321
321
|
contraDeduction: number;
|
|
322
322
|
crossAgeDeduction: number;
|
|
323
323
|
waivedDeduction: number;
|
|
324
|
+
balanceAfterCrossAge: number;
|
|
324
325
|
finalResult: number;
|
|
325
326
|
insuredComponent: number;
|
|
326
|
-
preliminaryEligibleBalance: number;
|
|
327
327
|
uninsuredComponent: number;
|
|
328
328
|
insuredAvailability: number;
|
|
329
329
|
uninsuredAvailability: number;
|
|
330
|
-
|
|
330
|
+
ARReserves: number;
|
|
331
331
|
ARAvailability: number;
|
|
332
332
|
};
|
|
333
|
+
actual?: boolean;
|
|
333
334
|
userCalculatedId?: mongoose.Types.ObjectId;
|
|
334
335
|
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
|
+
insuredCustomers: mongoose.Types.DocumentArray<{
|
|
342
342
|
limit?: number;
|
|
343
343
|
customer?: string;
|
|
344
344
|
}>;
|
|
345
|
-
|
|
345
|
+
permittedConcentration: mongoose.Types.DocumentArray<{
|
|
346
346
|
limit?: number;
|
|
347
347
|
customer?: string;
|
|
348
348
|
}>;
|
|
349
|
-
|
|
349
|
+
permittedExtendedARDays: 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 { IUser } from '../interfaces/auth-user.interface';
|
|
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?: IUser;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export const summarySchemeDesc = {
|
package/models/_index.d.ts
CHANGED
|
@@ -31,10 +31,10 @@ export declare const allSchemas: {
|
|
|
31
31
|
createdAt: NativeDate;
|
|
32
32
|
updatedAt: NativeDate;
|
|
33
33
|
} & {
|
|
34
|
-
order: number;
|
|
35
|
-
amount: number;
|
|
36
34
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
35
|
+
order: number;
|
|
37
36
|
apDate: Date;
|
|
37
|
+
amount: number;
|
|
38
38
|
__v?: number;
|
|
39
39
|
poNumber?: string;
|
|
40
40
|
customerName?: string;
|
|
@@ -45,10 +45,10 @@ export declare const allSchemas: {
|
|
|
45
45
|
createdAt: NativeDate;
|
|
46
46
|
updatedAt: NativeDate;
|
|
47
47
|
} & {
|
|
48
|
-
order: number;
|
|
49
|
-
amount: number;
|
|
50
48
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
49
|
+
order: number;
|
|
51
50
|
apDate: Date;
|
|
51
|
+
amount: number;
|
|
52
52
|
__v?: number;
|
|
53
53
|
poNumber?: string;
|
|
54
54
|
customerName?: string;
|
|
@@ -59,10 +59,10 @@ export declare const allSchemas: {
|
|
|
59
59
|
createdAt: NativeDate;
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
} & {
|
|
62
|
-
order: number;
|
|
63
|
-
amount: number;
|
|
64
62
|
bbcSheetId: import("mongoose").Types.ObjectId;
|
|
63
|
+
order: number;
|
|
65
64
|
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 { IUser } from '../interfaces/auth-user.interface';
|
|
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: IUser): Promise<IReceivableAvailabilityView>;
|
|
53
|
+
getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUser): 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: IUser): 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: IUser): Promise<IAvailabilityFullSummary>;
|
|
74
74
|
isBBCEditable(bbcDateId: string): Promise<boolean>;
|
|
75
75
|
toggleManualReceivableAvailability(bbcDateId: string, useManualInputs: boolean): Promise<void>;
|
|
76
76
|
}
|
|
@@ -91,7 +91,7 @@ class AvailabilityService {
|
|
|
91
91
|
const calculation = {
|
|
92
92
|
borrowerId: null,
|
|
93
93
|
bbcDateId: new mongoose_1.default.Types.ObjectId(bbcDateId),
|
|
94
|
-
userCalculatedId: user?.
|
|
94
|
+
userCalculatedId: user?.id ? new mongoose_1.default.Types.ObjectId(String(user.id)) : null,
|
|
95
95
|
calculatedAt: new Date(),
|
|
96
96
|
actual: true,
|
|
97
97
|
settings: calculationsSettings,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
IAvailabilitySummary,
|
|
15
15
|
IReceivableAvailabilityView,
|
|
16
16
|
} from '../models/ReceivableAvailability.model';
|
|
17
|
-
import {
|
|
17
|
+
import { IUser } from '../interfaces/auth-user.interface';
|
|
18
18
|
import { roundToXDigits } from '../helpers/numbers.helper';
|
|
19
19
|
import { AccountPayableItemModel } from '../models/AccountPayableItem.model';
|
|
20
20
|
import { ECollaterals } from '../enums/collaterals.enum';
|
|
@@ -34,7 +34,6 @@ import { IInventoryAvailabilitySummary, InventoryAvailabilityPaginators } from '
|
|
|
34
34
|
import { getBBCSheetsByType } from '../db/bbcSheets.db';
|
|
35
35
|
import { CustomerGroupModel } from '../models/CustomerGroup.model';
|
|
36
36
|
import { getPartialPaid } from '../queries/receivable/partially-paid-restated';
|
|
37
|
-
|
|
38
37
|
import MappedGroup from '../models/MappedGroup.model';
|
|
39
38
|
import CustomerAPGroup from '../models/CustomerAPGroup.model';
|
|
40
39
|
import { getReserveDocs } from '../db/reserve.db';
|
|
@@ -151,7 +150,7 @@ export class AvailabilityService {
|
|
|
151
150
|
return groupedSettings;
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
async calculateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
153
|
+
async calculateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUser): Promise<IReceivableAvailabilityView> {
|
|
155
154
|
|
|
156
155
|
const calculationsSettings = await this.getCalculationSettings(bbcDateId);
|
|
157
156
|
|
|
@@ -161,7 +160,7 @@ export class AvailabilityService {
|
|
|
161
160
|
const calculation: IReceivableAvailability = {
|
|
162
161
|
borrowerId: null,
|
|
163
162
|
bbcDateId: new mongoose.Types.ObjectId(bbcDateId),
|
|
164
|
-
userCalculatedId: user?.
|
|
163
|
+
userCalculatedId: user?.id ? new mongoose.Types.ObjectId(String(user.id)) : null,
|
|
165
164
|
calculatedAt: new Date(),
|
|
166
165
|
actual: true,
|
|
167
166
|
settings: calculationsSettings,
|
|
@@ -560,7 +559,7 @@ export class AvailabilityService {
|
|
|
560
559
|
return await this.getAvailability(bbcDateId, paginatorOptions, user);
|
|
561
560
|
}
|
|
562
561
|
|
|
563
|
-
async getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
562
|
+
async getAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUser) {
|
|
564
563
|
return await this.foundOrCreateAvailability(bbcDateId, paginatorOptions, user);
|
|
565
564
|
}
|
|
566
565
|
|
|
@@ -655,7 +654,7 @@ export class AvailabilityService {
|
|
|
655
654
|
return { itemsFilter: filterField, invoiceItems, customerItems: customerItemsWithTotal };
|
|
656
655
|
}
|
|
657
656
|
|
|
658
|
-
async foundOrCreateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user:
|
|
657
|
+
async foundOrCreateAvailability(bbcDateId: string, paginatorOptions: IPaginatorOptions, user: IUser) {
|
|
659
658
|
const foundAvailability = await this.findCalculatedAvailability(bbcDateId);
|
|
660
659
|
if (foundAvailability) {
|
|
661
660
|
foundAvailability.items = await this.getAvailabilityItems(foundAvailability._id.toString(), paginatorOptions);
|
|
@@ -989,7 +988,7 @@ export class AvailabilityService {
|
|
|
989
988
|
]);
|
|
990
989
|
}
|
|
991
990
|
|
|
992
|
-
async getAllSummaries(bbcDateId: string, user:
|
|
991
|
+
async getAllSummaries(bbcDateId: string, user: IUser): Promise<IAvailabilityFullSummary> {
|
|
993
992
|
const equipment = await this.equipmentService.getEquipmentForBBC(bbcDateId);
|
|
994
993
|
const reserve = await this.reserveService.getReserve(bbcDateId);
|
|
995
994
|
const loanBalances = await this.loanTransactionsService.getLoanBalanceForBBCDateId(bbcDateId);
|
|
@@ -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 { IUser } 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 {
|
|
@@ -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" | "fundingStatus" | "items"> | {
|
|
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: IUser): Promise<any>;
|
|
152
152
|
}
|
|
@@ -536,7 +536,7 @@ class ComplianceBorrowersService {
|
|
|
536
536
|
async getBorrowerListReport(user) {
|
|
537
537
|
const userFilter = user.allBorrowers
|
|
538
538
|
? { isVisible: true }
|
|
539
|
-
: { 'borrower': { $in: user.borrowersAccess
|
|
539
|
+
: { 'borrower': { $in: user.borrowersAccess }, isVisible: true };
|
|
540
540
|
const borrowers = await BorrowerCompliance_model_1.BorrowerCompliance
|
|
541
541
|
.find(userFilter)
|
|
542
542
|
.populate('borrower')
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
IComplianceBorrowerDocumentFull,
|
|
12
12
|
} from '../models/BorrowerCompliance.model';
|
|
13
13
|
import { BorrowerModel } from '../models/Borrower.model';
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import { IUser } from '../interfaces/auth-user.interface';
|
|
16
15
|
import FinancialComplianceBorrower from '../models/FinancialComplianceBorrower.model';
|
|
17
16
|
import { FileManagerService } from './file-manager.service';
|
|
18
17
|
import { UploadsService } from './uploads.service';
|
|
@@ -580,10 +579,10 @@ export class ComplianceBorrowersService {
|
|
|
580
579
|
}
|
|
581
580
|
}
|
|
582
581
|
|
|
583
|
-
async getBorrowerListReport(user:
|
|
582
|
+
async getBorrowerListReport(user: IUser) {
|
|
584
583
|
const userFilter = user.allBorrowers
|
|
585
584
|
? { isVisible: true }
|
|
586
|
-
: { 'borrower': { $in: user.borrowersAccess
|
|
585
|
+
: { 'borrower': { $in: user.borrowersAccess }, isVisible: true };
|
|
587
586
|
const borrowers = await BorrowerCompliance
|
|
588
587
|
.find(userFilter)
|
|
589
588
|
.populate('borrower')
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from 'mongoose';
|
|
26
26
|
import { IResult } from '../interfaces/result.interface';
|
|
27
|
-
import { IUserLegacyDoc } from '../models/User.model';
|
|
28
27
|
import { IAvailabilitySignView } from '../models/AvailabilitySigns.model';
|
|
29
28
|
import { IBBCDateDoc } from '../models/BBCDate.model';
|
|
30
29
|
import { IBorrowerDocument } from '../models/Borrower.model';
|
|
@@ -49,12 +48,12 @@ export declare class SignsService {
|
|
|
49
48
|
private readonly loanStatementService;
|
|
50
49
|
private readonly usersService;
|
|
51
50
|
constructor(lockService: LockService, loanTransactionsService: LoanTransactionsService, loanStatementService: LoanStatementService, usersService: UsersService);
|
|
52
|
-
|
|
51
|
+
users: IUser[];
|
|
53
52
|
fulfillUserList(): Promise<void>;
|
|
54
53
|
clearUserList(): void;
|
|
55
54
|
getAvailabilitySigns(bbcDateId: string): Promise<IAvailabilitySignView>;
|
|
56
55
|
revokeAvailability(bbcDateId: string, userId: string, userIdRevoked: string): Promise<void>;
|
|
57
|
-
signAvailability(bbcDateId: string, user:
|
|
56
|
+
signAvailability(bbcDateId: string, user: IUser): Promise<IResult>;
|
|
58
57
|
isBBCLocked(bbcDateId: string): Promise<boolean>;
|
|
59
58
|
getLatestSignedBBCDate(borrowerId: string, date?: Date): Promise<IBBCDateDoc>;
|
|
60
59
|
getSavedData(bbcDateId: string): Promise<any>;
|
|
@@ -32,12 +32,12 @@ class SignsService {
|
|
|
32
32
|
this.loanStatementService = loanStatementService;
|
|
33
33
|
this.usersService = usersService;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
users = null;
|
|
36
36
|
async fulfillUserList() {
|
|
37
|
-
this.
|
|
37
|
+
this.users = await this.usersService.getUserList();
|
|
38
38
|
}
|
|
39
39
|
clearUserList() {
|
|
40
|
-
this.
|
|
40
|
+
this.users = null;
|
|
41
41
|
}
|
|
42
42
|
async getAvailabilitySigns(bbcDateId) {
|
|
43
43
|
const availabilitiesSigns = await (0, availability_db_1.getAvailabilitySigns)([bbcDateId]);
|
|
@@ -50,7 +50,7 @@ class SignsService {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
const availabilitySigns = availabilitiesSigns[0];
|
|
53
|
-
let keyCloakUsers = this.
|
|
53
|
+
let keyCloakUsers = this.users;
|
|
54
54
|
if (!keyCloakUsers) {
|
|
55
55
|
keyCloakUsers = await this.usersService.getUserList();
|
|
56
56
|
}
|
|
@@ -58,14 +58,14 @@ class SignsService {
|
|
|
58
58
|
if (!userSign.userSigned) {
|
|
59
59
|
return acc;
|
|
60
60
|
}
|
|
61
|
-
const foundUserSigned = keyCloakUsers.find((user) => user.id === userSign.userSigned.
|
|
61
|
+
const foundUserSigned = keyCloakUsers.find((user) => user.id === userSign.userSigned.id);
|
|
62
62
|
if (foundUserSigned) {
|
|
63
63
|
userSign.userSigned.firstName = foundUserSigned.firstName;
|
|
64
64
|
userSign.userSigned.lastName = foundUserSigned.lastName;
|
|
65
65
|
}
|
|
66
66
|
userSign.userSigned = (lodash_1.default.pick(userSign.userSigned, ['_id', 'firstName', 'lastName']));
|
|
67
67
|
if (userSign.userRevoked) {
|
|
68
|
-
const foundUserRevoked = keyCloakUsers.find((user) => user.id === userSign.userRevoked.
|
|
68
|
+
const foundUserRevoked = keyCloakUsers.find((user) => user.id === userSign.userRevoked.id);
|
|
69
69
|
if (foundUserRevoked) {
|
|
70
70
|
userSign.userRevoked.firstName = foundUserRevoked.firstName;
|
|
71
71
|
userSign.userRevoked.lastName = foundUserRevoked.lastName;
|
|
@@ -80,16 +80,15 @@ class SignsService {
|
|
|
80
80
|
const availability = await (0, availability_db_1.findAvailabilitySignsByBBCDateId)(bbcDateId);
|
|
81
81
|
const updatedSigns = availability.signs.map((sign) => {
|
|
82
82
|
if (sign.userSignedId.toString() === userId && !sign.revokedAt) {
|
|
83
|
-
sign.userRevokedId =
|
|
83
|
+
sign.userRevokedId = userIdRevoked;
|
|
84
84
|
sign.revokedAt = new Date();
|
|
85
|
-
sign.userRevokedId = new mongoose_1.default.Types.ObjectId(userIdRevoked);
|
|
86
85
|
}
|
|
87
86
|
return sign;
|
|
88
87
|
});
|
|
89
88
|
await (0, availability_db_1.updateAvailabilitySigns)(bbcDateId, updatedSigns);
|
|
90
89
|
}
|
|
91
90
|
async signAvailability(bbcDateId, user) {
|
|
92
|
-
const newSign = { userSignedId: user.
|
|
91
|
+
const newSign = { userSignedId: user.id, signedAt: new Date() };
|
|
93
92
|
return await (0, availability_db_1.addAvailabilitySign)(bbcDateId, newSign);
|
|
94
93
|
}
|
|
95
94
|
async isBBCLocked(bbcDateId) {
|