gemcap-be-common 1.2.25 → 1.2.27
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/availability.db.d.ts +2 -2
- package/db/availability.db.js +7 -7
- package/db/availability.db.ts +3 -3
- package/db/bbcDates.db.d.ts +2 -2
- package/db/bbcDates.db.js +10 -9
- package/db/bbcDates.db.ts +3 -2
- package/db/bbcSheets.db.d.ts +2 -2
- package/db/bbcSheets.db.js +6 -6
- package/db/bbcSheets.db.ts +2 -2
- package/db/collaterals.db.d.ts +6 -6
- package/db/collaterals.db.js +17 -14
- package/db/collaterals.db.ts +7 -11
- package/db/inventory-availability.db.d.ts +2 -1
- package/db/inventory-availability.db.js +8 -7
- package/db/inventory-availability.db.ts +2 -3
- package/db/inventory-manual-entry.db.d.ts +1 -1
- package/db/inventory-manual-entry.db.js +2 -2
- package/db/inventory-manual-entry.db.ts +1 -1
- package/db/inventory-seasonal-rates.db.d.ts +1 -1
- package/db/inventory-seasonal-rates.db.js +5 -5
- package/db/inventory-seasonal-rates.db.ts +1 -1
- package/db/loan-products.db.d.ts +3 -2
- package/db/loan-products.db.js +18 -15
- package/db/loan-products.db.ts +9 -10
- package/db/loan-statement.db.js +4 -3
- package/db/loan-statement.db.ts +2 -1
- package/db/microservice-tasks.db.d.ts +2 -2
- package/db/microservice-tasks.db.js +9 -9
- package/db/microservice-tasks.db.ts +3 -2
- package/db/receivables.db.d.ts +1 -1
- package/db/receivables.db.js +24 -23
- package/db/receivables.db.ts +4 -3
- package/db/user-logs.db.d.ts +1 -1
- package/db/user-logs.db.js +2 -2
- package/db/user-logs.db.ts +1 -1
- package/helpers/column-desciptions.helper.d.ts +4 -4
- package/helpers/column-desciptions.helper.js +51 -49
- package/helpers/column-desciptions.helper.ts +7 -4
- package/helpers/numbers.helper.d.ts +1 -1
- package/helpers/numbers.helper.js +7 -6
- package/helpers/numbers.helper.ts +3 -2
- package/helpers/paginator.helper.d.ts +1 -1
- package/helpers/paginator.helper.js +2 -2
- package/helpers/paginator.helper.ts +1 -1
- package/helpers/users.helper.d.ts +2 -1
- package/helpers/users.helper.js +4 -4
- package/helpers/users.helper.ts +2 -1
- package/interfaces/collaterals.interface.d.ts +3 -1
- package/interfaces/collaterals.interface.ts +3 -1
- package/interfaces/custom-row.interface.d.ts +2 -1
- package/interfaces/custom-row.interface.ts +2 -1
- package/interfaces/email-addresses.interface.d.ts +1 -1
- package/interfaces/email-addresses.interface.ts +1 -1
- package/interfaces/query.interface.d.ts +1 -1
- package/interfaces/query.interface.ts +1 -1
- package/models/AccountPayableItem.model.d.ts +1 -1
- package/models/AccountPayableItem.model.ts +1 -1
- package/models/InventoryAvailability.model.d.ts +2 -2
- package/models/InventoryAvailability.model.js +1 -1
- package/models/InventoryAvailability.model.ts +2 -2
- package/models/InventoryItem.model.d.ts +1 -1
- package/models/InventoryItem.model.ts +1 -1
- package/models/LoanCharges.model.d.ts +2 -1
- package/models/LoanCharges.model.js +34 -32
- package/models/LoanCharges.model.ts +3 -2
- package/models/LoanProducts.model.d.ts +1 -1
- package/models/LoanProducts.model.ts +1 -1
- package/models/LoanTransaction.model.js +5 -5
- package/models/LoanTransaction.model.ts +1 -1
- package/models/MicroserviceTask.model.d.ts +2 -1
- package/models/MicroserviceTask.model.js +2 -1
- package/models/MicroserviceTask.model.ts +4 -3
- package/models/ReceivableItem.model.d.ts +1 -1
- package/models/ReceivableItem.model.ts +1 -1
- package/models/Yield.model.d.ts +1 -1
- package/models/Yield.model.ts +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/db/index.d.ts +0 -12
- package/db/index.js +0 -28
- package/db/index.ts +0 -12
- package/enums/index.d.ts +0 -14
- package/enums/index.js +0 -30
- package/enums/index.ts +0 -14
- package/helpers/index.d.ts +0 -9
- package/helpers/index.js +0 -25
- package/helpers/index.ts +0 -9
- package/interfaces/index.d.ts +0 -14
- package/interfaces/index.js +0 -30
- package/interfaces/index.ts +0 -14
- package/models/index.d.ts +0 -29
- package/models/index.js +0 -45
- package/models/index.ts +0 -29
|
@@ -1,136 +1,138 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertIntoDates = exports.COLLATERALS = void 0;
|
|
4
|
-
const
|
|
4
|
+
const collaterals_enum_1 = require("../enums/collaterals.enum");
|
|
5
|
+
const validators_enums_1 = require("../enums/validators.enums");
|
|
6
|
+
const data_types_enum_1 = require("../enums/data-types.enum");
|
|
5
7
|
exports.COLLATERALS = {
|
|
6
|
-
[
|
|
8
|
+
[collaterals_enum_1.ECollaterals.INVENTORY]: [
|
|
7
9
|
{
|
|
8
10
|
db_title: 'bbcDate',
|
|
9
11
|
title: 'BBC date',
|
|
10
12
|
required: false,
|
|
11
13
|
items: [],
|
|
12
14
|
hidden: true,
|
|
13
|
-
validators: [
|
|
14
|
-
dataType:
|
|
15
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_DATE],
|
|
16
|
+
dataType: data_types_enum_1.EDataTypes.DATE,
|
|
15
17
|
},
|
|
16
18
|
{
|
|
17
19
|
db_title: 'skuDate',
|
|
18
20
|
title: 'SKU date',
|
|
19
21
|
required: false,
|
|
20
22
|
items: [],
|
|
21
|
-
validators: [
|
|
23
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
22
24
|
isDate: true,
|
|
23
|
-
dataType:
|
|
25
|
+
dataType: data_types_enum_1.EDataTypes.DATE,
|
|
24
26
|
},
|
|
25
27
|
{
|
|
26
28
|
db_title: 'sku',
|
|
27
29
|
title: 'SKU',
|
|
28
30
|
required: true,
|
|
29
31
|
items: [],
|
|
30
|
-
validators: [
|
|
31
|
-
dataType:
|
|
32
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
33
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
32
34
|
},
|
|
33
|
-
{ db_title: 'lotNumber', title: '#LOT', required: false, items: [], dataType:
|
|
34
|
-
{ db_title: 'category', title: 'Category', required: false, items: [], dataType:
|
|
35
|
+
{ db_title: 'lotNumber', title: '#LOT', required: false, items: [], dataType: data_types_enum_1.EDataTypes.STRING },
|
|
36
|
+
{ db_title: 'category', title: 'Category', required: false, items: [], dataType: data_types_enum_1.EDataTypes.STRING },
|
|
35
37
|
{
|
|
36
38
|
db_title: 'qty',
|
|
37
39
|
title: 'Qty',
|
|
38
40
|
required: false,
|
|
39
41
|
items: [],
|
|
40
|
-
validators: [
|
|
41
|
-
dataType:
|
|
42
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_NUMBER],
|
|
43
|
+
dataType: data_types_enum_1.EDataTypes.NUMBER,
|
|
42
44
|
},
|
|
43
45
|
{
|
|
44
46
|
db_title: 'unitCost',
|
|
45
47
|
title: 'Unit cost',
|
|
46
48
|
required: false,
|
|
47
49
|
items: [],
|
|
48
|
-
validators: [
|
|
49
|
-
dataType:
|
|
50
|
+
validators: [validators_enums_1.EValidators.IS_NUMBER],
|
|
51
|
+
dataType: data_types_enum_1.EDataTypes.NUMBER,
|
|
50
52
|
},
|
|
51
53
|
{
|
|
52
54
|
db_title: 'value',
|
|
53
55
|
title: 'Value',
|
|
54
56
|
required: true,
|
|
55
57
|
items: [],
|
|
56
|
-
validators: [
|
|
57
|
-
dataType:
|
|
58
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_NUMBER],
|
|
59
|
+
dataType: data_types_enum_1.EDataTypes.NUMBER,
|
|
58
60
|
},
|
|
59
61
|
{
|
|
60
62
|
db_title: 'expiryDate',
|
|
61
63
|
title: 'Expiry date',
|
|
62
64
|
required: false,
|
|
63
65
|
items: [],
|
|
64
|
-
validators: [
|
|
66
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
65
67
|
isDate: true,
|
|
66
|
-
dataType:
|
|
68
|
+
dataType: data_types_enum_1.EDataTypes.DATE,
|
|
67
69
|
},
|
|
68
|
-
{ db_title: 'location', title: 'Location', required: false, items: [], dataType:
|
|
70
|
+
{ db_title: 'location', title: 'Location', required: false, items: [], dataType: data_types_enum_1.EDataTypes.STRING },
|
|
69
71
|
{
|
|
70
72
|
db_title: 'skuDescription1',
|
|
71
73
|
title: 'SKU Description 1',
|
|
72
74
|
required: false,
|
|
73
75
|
items: [],
|
|
74
|
-
dataType:
|
|
76
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
75
77
|
},
|
|
76
78
|
{
|
|
77
79
|
db_title: 'skuDescription2',
|
|
78
80
|
title: 'SKU Description 2',
|
|
79
81
|
required: false,
|
|
80
82
|
items: [],
|
|
81
|
-
dataType:
|
|
83
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
82
84
|
},
|
|
83
85
|
{
|
|
84
86
|
db_title: 'skuDescription3',
|
|
85
87
|
title: 'SKU Description 3',
|
|
86
88
|
required: false,
|
|
87
89
|
items: [],
|
|
88
|
-
dataType:
|
|
90
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
89
91
|
},
|
|
90
92
|
{
|
|
91
93
|
db_title: 'detail1',
|
|
92
94
|
title: 'Detail 1',
|
|
93
95
|
required: false,
|
|
94
96
|
items: [],
|
|
95
|
-
dataType:
|
|
97
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
100
|
db_title: 'detail2',
|
|
99
101
|
title: 'Detail 2',
|
|
100
102
|
required: false,
|
|
101
103
|
items: [],
|
|
102
|
-
dataType:
|
|
104
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
103
105
|
},
|
|
104
106
|
{
|
|
105
107
|
db_title: 'detail3',
|
|
106
108
|
title: 'Detail 3',
|
|
107
109
|
required: false,
|
|
108
110
|
items: [],
|
|
109
|
-
dataType:
|
|
111
|
+
dataType: data_types_enum_1.EDataTypes.STRING,
|
|
110
112
|
},
|
|
111
113
|
],
|
|
112
|
-
[
|
|
114
|
+
[collaterals_enum_1.ECollaterals.RECEIVABLE]: [
|
|
113
115
|
{
|
|
114
116
|
db_title: 'bbcDate',
|
|
115
117
|
title: 'BBC date',
|
|
116
118
|
required: false,
|
|
117
119
|
items: [],
|
|
118
120
|
hidden: true,
|
|
119
|
-
validators: [
|
|
121
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_DATE],
|
|
120
122
|
},
|
|
121
123
|
{
|
|
122
124
|
db_title: 'invoiceNumber',
|
|
123
125
|
title: 'Invoice number',
|
|
124
126
|
required: true,
|
|
125
127
|
items: [],
|
|
126
|
-
validators: [
|
|
128
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
127
129
|
},
|
|
128
130
|
{
|
|
129
131
|
db_title: 'invoiceDate',
|
|
130
132
|
title: 'Invoice date',
|
|
131
133
|
required: true,
|
|
132
134
|
items: [],
|
|
133
|
-
validators: [
|
|
135
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_DATE],
|
|
134
136
|
isDate: true,
|
|
135
137
|
},
|
|
136
138
|
{
|
|
@@ -138,28 +140,28 @@ exports.COLLATERALS = {
|
|
|
138
140
|
title: 'Customer title',
|
|
139
141
|
required: true,
|
|
140
142
|
items: [],
|
|
141
|
-
validators: [
|
|
143
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
142
144
|
},
|
|
143
145
|
{
|
|
144
146
|
db_title: 'invoiceAmount',
|
|
145
147
|
title: 'Invoice amount',
|
|
146
148
|
required: true,
|
|
147
149
|
items: [],
|
|
148
|
-
validators: [
|
|
150
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_NUMBER],
|
|
149
151
|
},
|
|
150
152
|
{
|
|
151
153
|
db_title: 'originalAmount',
|
|
152
154
|
title: 'Original amount',
|
|
153
155
|
required: false,
|
|
154
156
|
items: [],
|
|
155
|
-
validators: [
|
|
157
|
+
validators: [validators_enums_1.EValidators.IS_NUMBER],
|
|
156
158
|
},
|
|
157
159
|
{
|
|
158
160
|
db_title: 'dueDate',
|
|
159
161
|
title: 'Due date',
|
|
160
162
|
required: false,
|
|
161
163
|
items: [],
|
|
162
|
-
validators: [
|
|
164
|
+
validators: [validators_enums_1.EValidators.IS_DATE],
|
|
163
165
|
isDate: true,
|
|
164
166
|
},
|
|
165
167
|
{
|
|
@@ -181,20 +183,20 @@ exports.COLLATERALS = {
|
|
|
181
183
|
items: [],
|
|
182
184
|
},
|
|
183
185
|
],
|
|
184
|
-
[
|
|
186
|
+
[collaterals_enum_1.ECollaterals.ACCOUNT_PAYABLE]: [
|
|
185
187
|
{
|
|
186
188
|
db_title: 'bbcDate',
|
|
187
189
|
title: 'BBC date',
|
|
188
190
|
required: false,
|
|
189
191
|
items: [],
|
|
190
|
-
validators: [
|
|
192
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_DATE],
|
|
191
193
|
},
|
|
192
194
|
{
|
|
193
195
|
db_title: 'apDate',
|
|
194
196
|
title: 'AP date',
|
|
195
197
|
required: false,
|
|
196
198
|
items: [],
|
|
197
|
-
validators: [
|
|
199
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_DATE],
|
|
198
200
|
isDate: true,
|
|
199
201
|
},
|
|
200
202
|
{ db_title: 'poNumber', title: 'PO number', required: false, items: [] },
|
|
@@ -204,19 +206,19 @@ exports.COLLATERALS = {
|
|
|
204
206
|
title: 'Amount',
|
|
205
207
|
required: true,
|
|
206
208
|
items: [],
|
|
207
|
-
validators: [
|
|
209
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_NUMBER, validators_enums_1.EValidators.NUMBER_GT_NULL],
|
|
208
210
|
},
|
|
209
211
|
{ db_title: 'otherInformation1', title: 'Other Information 1', required: false, items: [] },
|
|
210
212
|
{ db_title: 'otherInformation2', title: 'Other Information 2', required: false, items: [] },
|
|
211
213
|
{ db_title: 'otherInformation3', title: 'Other Information 3', required: false, items: [] },
|
|
212
214
|
],
|
|
213
|
-
[
|
|
215
|
+
[collaterals_enum_1.ECollaterals.BANKS]: [
|
|
214
216
|
{
|
|
215
217
|
db_title: 'date',
|
|
216
218
|
title: 'Transaction date',
|
|
217
219
|
required: true,
|
|
218
220
|
items: [],
|
|
219
|
-
validators: [
|
|
221
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_DATE],
|
|
220
222
|
isDate: true,
|
|
221
223
|
},
|
|
222
224
|
{
|
|
@@ -224,28 +226,28 @@ exports.COLLATERALS = {
|
|
|
224
226
|
title: 'Ledger account code',
|
|
225
227
|
required: true,
|
|
226
228
|
items: [],
|
|
227
|
-
validators: [
|
|
229
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
228
230
|
},
|
|
229
231
|
{
|
|
230
232
|
db_title: 'amount',
|
|
231
233
|
title: 'Amount',
|
|
232
234
|
required: true,
|
|
233
235
|
items: [],
|
|
234
|
-
validators: [
|
|
236
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY, validators_enums_1.EValidators.IS_NUMBER],
|
|
235
237
|
},
|
|
236
238
|
{
|
|
237
239
|
db_title: 'description',
|
|
238
240
|
title: 'Description',
|
|
239
241
|
required: true,
|
|
240
242
|
items: [],
|
|
241
|
-
validators: [
|
|
243
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
242
244
|
},
|
|
243
245
|
{
|
|
244
246
|
db_title: 'reference',
|
|
245
247
|
title: 'Reference',
|
|
246
248
|
required: true,
|
|
247
249
|
items: [],
|
|
248
|
-
validators: [
|
|
250
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
249
251
|
},
|
|
250
252
|
{
|
|
251
253
|
db_title: 'customerId',
|
|
@@ -259,36 +261,36 @@ exports.COLLATERALS = {
|
|
|
259
261
|
title: 'Bank account number',
|
|
260
262
|
required: true,
|
|
261
263
|
items: [],
|
|
262
|
-
validators: [
|
|
264
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
263
265
|
},
|
|
264
266
|
],
|
|
265
|
-
[
|
|
267
|
+
[collaterals_enum_1.ECollaterals.QUICKBOOKS]: [
|
|
266
268
|
{
|
|
267
269
|
db_title: 'accountCode',
|
|
268
270
|
title: 'Account Code',
|
|
269
271
|
required: true,
|
|
270
272
|
items: [],
|
|
271
|
-
validators: [
|
|
273
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
272
274
|
},
|
|
273
275
|
{
|
|
274
276
|
db_title: 'fullName',
|
|
275
277
|
title: 'Full Name',
|
|
276
278
|
required: true,
|
|
277
279
|
items: [],
|
|
278
|
-
validators: [
|
|
280
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
279
281
|
}, {
|
|
280
282
|
db_title: 'description',
|
|
281
283
|
title: 'Description',
|
|
282
284
|
required: true,
|
|
283
285
|
items: [],
|
|
284
|
-
validators: [
|
|
286
|
+
validators: [validators_enums_1.EValidators.NOT_EMPTY],
|
|
285
287
|
},
|
|
286
288
|
],
|
|
287
289
|
};
|
|
288
290
|
const convertIntoDates = (item, collateralType) => {
|
|
289
291
|
return Object.keys(item).reduce((_, key) => {
|
|
290
292
|
const foundColumn = exports.COLLATERALS[collateralType].find((c) => c.db_title === key);
|
|
291
|
-
if (!!foundColumn && !!foundColumn.validators && foundColumn.validators.includes(
|
|
293
|
+
if (!!foundColumn && !!foundColumn.validators && foundColumn.validators.includes(validators_enums_1.EValidators.IS_DATE)) {
|
|
292
294
|
if (!!item[key]) {
|
|
293
295
|
const newDate = new Date(item[key].toString().trim().replace(' ', ''));
|
|
294
296
|
if (newDate instanceof Date && !isNaN(newDate.valueOf())) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ICustomRow } from '../interfaces';
|
|
2
|
-
import { ECollaterals
|
|
1
|
+
import { ICustomRow } from '../interfaces/custom-row.interface';
|
|
2
|
+
import { ECollaterals } from '../enums/collaterals.enum';
|
|
3
|
+
import { EValidators } from '../enums/validators.enums';
|
|
4
|
+
import { EDataTypes } from '../enums/data-types.enum';
|
|
3
5
|
|
|
4
|
-
export
|
|
6
|
+
export let COLLATERALS: { [p: string]: ICustomRow[] };
|
|
7
|
+
COLLATERALS = {
|
|
5
8
|
[ECollaterals.INVENTORY]: [
|
|
6
9
|
{
|
|
7
10
|
db_title: 'bbcDate',
|
|
@@ -276,7 +279,7 @@ export const COLLATERALS: { [key: string]: ICustomRow[] } = {
|
|
|
276
279
|
required: true,
|
|
277
280
|
items: [],
|
|
278
281
|
validators: [EValidators.NOT_EMPTY],
|
|
279
|
-
},
|
|
282
|
+
}, {
|
|
280
283
|
db_title: 'description',
|
|
281
284
|
title: 'Description',
|
|
282
285
|
required: true,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatNumbers = exports.numberWithCommas = exports.roundToXDigits = exports.round = exports.uniqueDates = exports.getDigitsFrequencies = exports.convertToPercentage = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const Inventory_model_1 = require("../models/Inventory.model");
|
|
5
|
+
const Receivable_model_1 = require("../models/Receivable.model");
|
|
6
|
+
const collaterals_enum_1 = require("../enums/collaterals.enum");
|
|
6
7
|
const defaultFormatterOptions = {
|
|
7
8
|
fractions: 2,
|
|
8
9
|
};
|
|
@@ -21,11 +22,11 @@ exports.getDigitsFrequencies = getDigitsFrequencies;
|
|
|
21
22
|
const uniqueDates = async (borrowerId, deep, collateral) => {
|
|
22
23
|
let bbcDates;
|
|
23
24
|
switch (collateral) {
|
|
24
|
-
case
|
|
25
|
-
bbcDates = await
|
|
25
|
+
case collaterals_enum_1.ECollaterals.INVENTORY:
|
|
26
|
+
bbcDates = await Inventory_model_1.InventoryModel.find({ borrowerId }, { _id: 1, bbcDate: 1 }).sort([['bbcDate', -1]]);
|
|
26
27
|
break;
|
|
27
|
-
case
|
|
28
|
-
bbcDates = await
|
|
28
|
+
case collaterals_enum_1.ECollaterals.RECEIVABLE:
|
|
29
|
+
bbcDates = await Receivable_model_1.ReceivableModel.find({ borrowerId }, { _id: 1, bbcDate: 1 }).sort([['bbcDate', -1]]);
|
|
29
30
|
break;
|
|
30
31
|
default:
|
|
31
32
|
throw new Error('Wrong collateral type');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { InventoryModel
|
|
2
|
-
import {
|
|
1
|
+
import { InventoryModel } from '../models/Inventory.model';
|
|
2
|
+
import { ReceivableModel } from '../models/Receivable.model';
|
|
3
|
+
import { ECollaterals } from '../enums/collaterals.enum';
|
|
3
4
|
|
|
4
5
|
interface IFormatterOptions {
|
|
5
6
|
fractions?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPaginatorOptions } from '../interfaces';
|
|
1
|
+
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
2
2
|
export declare const getPaginator: (request: any) => IPaginatorOptions;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPaginator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const collaterals_interface_1 = require("../interfaces/collaterals.interface");
|
|
5
5
|
const getPaginator = (request) => {
|
|
6
|
-
const paginator = { ...
|
|
6
|
+
const paginator = { ...collaterals_interface_1.DEFAULT_PAGINATOR };
|
|
7
7
|
if (request.pageIndex) {
|
|
8
8
|
paginator.pageIndex = +request.pageIndex;
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PAGINATOR, IPaginatorOptions } from '../interfaces';
|
|
1
|
+
import { DEFAULT_PAGINATOR, IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
2
2
|
|
|
3
3
|
export const getPaginator = (request): IPaginatorOptions => {
|
|
4
4
|
const paginator = { ...DEFAULT_PAGINATOR };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Token } from 'keycloak-connect';
|
|
2
|
-
import { EModules
|
|
2
|
+
import { EModules } from '../enums/modules.enum';
|
|
3
|
+
import { EUserRoles } from '../enums/user-types.enum';
|
|
3
4
|
export type AllowedRolesPerModule = {
|
|
4
5
|
[key in EModules]?: EUserRoles[];
|
|
5
6
|
};
|
package/helpers/users.helper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.USER_ACCESS_GROUPS = exports.checkUserAccess = void 0;
|
|
4
|
-
const
|
|
4
|
+
const user_types_enum_1 = require("../enums/user-types.enum");
|
|
5
5
|
const checkUserAccess = (token, allowedUsers) => {
|
|
6
6
|
let hasAccess = false;
|
|
7
7
|
Object.entries(allowedUsers).forEach(([accessModule, allowedUsers]) => {
|
|
@@ -11,7 +11,7 @@ const checkUserAccess = (token, allowedUsers) => {
|
|
|
11
11
|
};
|
|
12
12
|
exports.checkUserAccess = checkUserAccess;
|
|
13
13
|
exports.USER_ACCESS_GROUPS = {
|
|
14
|
-
ADMIN_ONLY: [
|
|
15
|
-
ALL_INTERNAL: [
|
|
16
|
-
ALL_ALLOWED: [
|
|
14
|
+
ADMIN_ONLY: [user_types_enum_1.EUserRoles.ADMIN],
|
|
15
|
+
ALL_INTERNAL: [user_types_enum_1.EUserRoles.ADMIN, user_types_enum_1.EUserRoles.USER],
|
|
16
|
+
ALL_ALLOWED: [user_types_enum_1.EUserRoles.ADMIN, user_types_enum_1.EUserRoles.USER, user_types_enum_1.EUserRoles.USER_EXTERNAL, user_types_enum_1.EUserRoles.READ_ONLY],
|
|
17
17
|
};
|
package/helpers/users.helper.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Token } from 'keycloak-connect';
|
|
2
2
|
|
|
3
|
-
import { EModules
|
|
3
|
+
import { EModules } from '../enums/modules.enum';
|
|
4
|
+
import { EUserRoles } from '../enums/user-types.enum';
|
|
4
5
|
|
|
5
6
|
export type AllowedRolesPerModule = { [key in EModules]?: EUserRoles[] }
|
|
6
7
|
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
|
-
import {
|
|
26
|
+
import { IInventoryItem } from '../models/InventoryItem.model';
|
|
27
|
+
import { IReceivableItem } from '../models/ReceivableItem.model';
|
|
28
|
+
import { IAccountPayableItem } from '../models/AccountPayableItem.model';
|
|
27
29
|
export interface IUploadedItems<T extends IInventoryItem | IReceivableItem | IAccountPayableItem> {
|
|
28
30
|
_id?: string;
|
|
29
31
|
bbcDate: Date;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { IInventoryItem } from '../models/InventoryItem.model';
|
|
4
|
+
import { IReceivableItem } from '../models/ReceivableItem.model';
|
|
5
|
+
import { IAccountPayableItem } from '../models/AccountPayableItem.model';
|
|
4
6
|
|
|
5
7
|
export interface IUploadedItems<T extends IInventoryItem | IReceivableItem | IAccountPayableItem> {
|
|
6
8
|
_id?: string;
|
|
@@ -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 { ICollateralItem } from '../interfaces';
|
|
26
|
+
import { ICollateralItem } from '../interfaces/collaterals.interface';
|
|
27
27
|
export declare const ACCOUNT_PAYABLE_FIELDS: string[];
|
|
28
28
|
export interface IAccountPayableItem extends ICollateralItem {
|
|
29
29
|
bbcDate: Date;
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose from 'mongoose';
|
|
26
26
|
import { IInventoryItemDocWithCalculation } from './InventoryItem.model';
|
|
27
|
-
import { EInventoryAvailabilityResults } from '../enums';
|
|
28
|
-
import { IPaginatorOptions } from '../interfaces';
|
|
27
|
+
import { EInventoryAvailabilityResults } from '../enums/inventory-availability-results.enum';
|
|
28
|
+
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
29
29
|
export interface IInventoryQuery {
|
|
30
30
|
conjunction: string;
|
|
31
31
|
field: string;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.InventoryAvailabilityModel = exports.getNormalizedValue = exports.mapMatcherObjNew = exports.mapMatcherObj = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
-
const
|
|
8
|
+
const inventory_availability_results_enum_1 = require("../enums/inventory-availability-results.enum");
|
|
9
9
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
10
10
|
exports.mapMatcherObj = {
|
|
11
11
|
GT: (query) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
3
|
import { IInventoryItemDocWithCalculation } from './InventoryItem.model';
|
|
4
|
-
import { EInventoryAvailabilityResults } from '../enums';
|
|
5
|
-
import { IPaginatorOptions } from '../interfaces';
|
|
4
|
+
import { EInventoryAvailabilityResults } from '../enums/inventory-availability-results.enum';
|
|
5
|
+
import { IPaginatorOptions } from '../interfaces/collaterals.interface';
|
|
6
6
|
|
|
7
7
|
const mongooseLeanId = require('../plugins/id.plugin');
|
|
8
8
|
|
|
@@ -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 { ICollateralItem } from '../interfaces';
|
|
26
|
+
import { ICollateralItem } from '../interfaces/collaterals.interface';
|
|
27
27
|
import { IBBCSheetDoc } from './BBCSheet.model';
|
|
28
28
|
import { IBBCDateDoc } from './BBCDate.model';
|
|
29
29
|
export declare const INVENTORY_FIELDS: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import mongoose, { Document } from 'mongoose';
|
|
2
2
|
|
|
3
|
-
import { ICollateralItem } from '../interfaces';
|
|
3
|
+
import { ICollateralItem } from '../interfaces/collaterals.interface';
|
|
4
4
|
import { IBBCSheetDoc } from './BBCSheet.model';
|
|
5
5
|
import { IBBCDateDoc } from './BBCDate.model';
|
|
6
6
|
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from 'mongoose';
|
|
26
26
|
import Joi from 'joi';
|
|
27
|
-
import { EChargeCalculationBasis, EChargeFrequencies
|
|
27
|
+
import { EChargeCalculationBasis, EChargeFrequencies } from '../enums/loan-types.enum';
|
|
28
|
+
import { ELoanChargeType } from '../enums/loan-charge-type.enum';
|
|
28
29
|
export declare const chargeViewValidationSchema: Joi.ObjectSchema<ILoanChargeView & {
|
|
29
30
|
valid: boolean;
|
|
30
31
|
}>;
|