gemcap-be-common 1.1.6 → 1.1.8

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.
Files changed (56) hide show
  1. package/db/index.js +17 -1
  2. package/db/inventory-availability.js +7 -3
  3. package/enums/collaterals.enum.js +5 -2
  4. package/enums/data-types.enum.js +5 -2
  5. package/enums/equipment-types.enum.js +5 -2
  6. package/enums/index.js +28 -12
  7. package/enums/inventory-availability-results.enum.js +5 -2
  8. package/enums/item-progress-status.enum.js +5 -2
  9. package/enums/loan-charge-type.enum.js +5 -2
  10. package/enums/loan-types.enum.js +9 -6
  11. package/enums/modules.enum.js +5 -2
  12. package/enums/reserve-types.enum.js +5 -2
  13. package/enums/upload-types.enum.js +5 -2
  14. package/enums/user-types.enum.js +5 -2
  15. package/enums/validators.enums.js +5 -2
  16. package/helpers/column-desciptions.helper.js +51 -47
  17. package/helpers/common.helper.js +10 -3
  18. package/helpers/date.helper.js +36 -22
  19. package/helpers/enums.helper.js +5 -1
  20. package/helpers/exec.js +7 -3
  21. package/helpers/index.js +25 -9
  22. package/helpers/mongo.helper.js +21 -12
  23. package/helpers/numbers.helper.js +23 -12
  24. package/helpers/paginator.helper.js +7 -3
  25. package/helpers/users.helper.js +10 -6
  26. package/interfaces/collaterals.interface.js +4 -1
  27. package/interfaces/custom-row.interface.js +2 -1
  28. package/interfaces/cync-loan-data.interface.js +2 -1
  29. package/interfaces/email-addresses.interface.js +2 -1
  30. package/interfaces/email.interface.js +2 -1
  31. package/interfaces/group.interface.js +2 -1
  32. package/interfaces/index.js +29 -13
  33. package/interfaces/keycloak-role.interface.js +2 -1
  34. package/interfaces/keycloak-user.interface.js +2 -1
  35. package/interfaces/multer.interface.js +2 -1
  36. package/interfaces/plaid-data.interface.js +2 -1
  37. package/interfaces/query.interface.js +2 -1
  38. package/interfaces/result.interface.js +2 -1
  39. package/interfaces/upload-data.interface.js +2 -1
  40. package/models/AccountPayableItem.model.js +11 -5
  41. package/models/BBCDate.model.d.ts +1 -2
  42. package/models/BBCDate.model.js +10 -4
  43. package/models/BBCDate.model.ts +1 -1
  44. package/models/BBCSheet.model.d.ts +1 -2
  45. package/models/BBCSheet.model.js +17 -11
  46. package/models/BBCSheet.model.ts +1 -1
  47. package/models/ComplianceItem.model.js +8 -3
  48. package/models/Inventory.model.js +8 -3
  49. package/models/InventoryAvailability.model.js +13 -7
  50. package/models/InventoryItem.model.js +11 -5
  51. package/models/ReceiavableItem.model.js +11 -5
  52. package/models/Receivable.model.js +8 -3
  53. package/models/index.js +25 -9
  54. package/package.json +1 -1
  55. package/tsconfig.json +2 -3
  56. package/tsconfig.tsbuildinfo +1 -1
package/db/index.js CHANGED
@@ -1 +1,17 @@
1
- export * from './inventory-availability';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./inventory-availability"), exports);
@@ -1,6 +1,10 @@
1
- import { InventoryAvailabilityModel } from '../models';
2
- export const getInventoryAvailabilityByBBCDateId = async (bbcDateId) => {
3
- return InventoryAvailabilityModel
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInventoryAvailabilityByBBCDateId = void 0;
4
+ const models_1 = require("../models");
5
+ const getInventoryAvailabilityByBBCDateId = async (bbcDateId) => {
6
+ return models_1.InventoryAvailabilityModel
4
7
  .findOne({ bbcDateId })
5
8
  .lean();
6
9
  };
10
+ exports.getInventoryAvailabilityByBBCDateId = getInventoryAvailabilityByBBCDateId;
@@ -1,4 +1,7 @@
1
- export var ECollaterals;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ECollaterals = void 0;
4
+ var ECollaterals;
2
5
  (function (ECollaterals) {
3
6
  ECollaterals["INVENTORY"] = "INVENTORY";
4
7
  ECollaterals["RECEIVABLE"] = "RECEIVABLE";
@@ -6,4 +9,4 @@ export var ECollaterals;
6
9
  ECollaterals["OTHER"] = "OTHER";
7
10
  ECollaterals["CASH"] = "CASH";
8
11
  ECollaterals["BANKS"] = "BANKS";
9
- })(ECollaterals || (ECollaterals = {}));
12
+ })(ECollaterals || (exports.ECollaterals = ECollaterals = {}));
@@ -1,6 +1,9 @@
1
- export var EDataTypes;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EDataTypes = void 0;
4
+ var EDataTypes;
2
5
  (function (EDataTypes) {
3
6
  EDataTypes["STRING"] = "string";
4
7
  EDataTypes["NUMBER"] = "number";
5
8
  EDataTypes["DATE"] = "date";
6
- })(EDataTypes || (EDataTypes = {}));
9
+ })(EDataTypes || (exports.EDataTypes = EDataTypes = {}));
@@ -1,7 +1,10 @@
1
- export var EEquipmentTypes;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EEquipmentTypes = void 0;
4
+ var EEquipmentTypes;
2
5
  (function (EEquipmentTypes) {
3
6
  EEquipmentTypes["EQUIPMENT"] = "EQUIPMENT";
4
7
  EEquipmentTypes["INTELLECTUAL_PROPERTY"] = "INTELLECTUAL_PROPERTY";
5
8
  EEquipmentTypes["REAL_ESTATE"] = "REAL_ESTATE";
6
9
  EEquipmentTypes["BOOT_COLLATERAL"] = "BOOT_COLLATERAL";
7
- })(EEquipmentTypes || (EEquipmentTypes = {}));
10
+ })(EEquipmentTypes || (exports.EEquipmentTypes = EEquipmentTypes = {}));
package/enums/index.js CHANGED
@@ -1,12 +1,28 @@
1
- export * from './collaterals.enum';
2
- export * from './data-types.enum';
3
- export * from './equipment-types.enum';
4
- export * from './inventory-availability-results.enum';
5
- export * from './item-progress-status.enum';
6
- export * from './loan-charge-type.enum';
7
- export * from './loan-types.enum';
8
- export * from './modules.enum';
9
- export * from './reserve-types.enum';
10
- export * from './upload-types.enum';
11
- export * from './user-types.enum';
12
- export * from './validators.enums';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./collaterals.enum"), exports);
18
+ __exportStar(require("./data-types.enum"), exports);
19
+ __exportStar(require("./equipment-types.enum"), exports);
20
+ __exportStar(require("./inventory-availability-results.enum"), exports);
21
+ __exportStar(require("./item-progress-status.enum"), exports);
22
+ __exportStar(require("./loan-charge-type.enum"), exports);
23
+ __exportStar(require("./loan-types.enum"), exports);
24
+ __exportStar(require("./modules.enum"), exports);
25
+ __exportStar(require("./reserve-types.enum"), exports);
26
+ __exportStar(require("./upload-types.enum"), exports);
27
+ __exportStar(require("./user-types.enum"), exports);
28
+ __exportStar(require("./validators.enums"), exports);
@@ -1,6 +1,9 @@
1
- export var EInventoryAvailabilityResults;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EInventoryAvailabilityResults = void 0;
4
+ var EInventoryAvailabilityResults;
2
5
  (function (EInventoryAvailabilityResults) {
3
6
  EInventoryAvailabilityResults["UNIQ_ITEMS"] = "uniqItems";
4
7
  EInventoryAvailabilityResults["NON_UNIQ_ITEMS"] = "nonUniqItems";
5
8
  EInventoryAvailabilityResults["NOT_MATCHED_ITEMS"] = "notMatchedItems";
6
- })(EInventoryAvailabilityResults || (EInventoryAvailabilityResults = {}));
9
+ })(EInventoryAvailabilityResults || (exports.EInventoryAvailabilityResults = EInventoryAvailabilityResults = {}));
@@ -1,6 +1,9 @@
1
- export var EItemProgressStatus;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EItemProgressStatus = void 0;
4
+ var EItemProgressStatus;
2
5
  (function (EItemProgressStatus) {
3
6
  EItemProgressStatus["IN_REVIEW"] = "IN_REVIEW";
4
7
  EItemProgressStatus["OVERDUE"] = "OVERDUE";
5
8
  EItemProgressStatus["DUE"] = "DUE";
6
- })(EItemProgressStatus || (EItemProgressStatus = {}));
9
+ })(EItemProgressStatus || (exports.EItemProgressStatus = EItemProgressStatus = {}));
@@ -1,4 +1,7 @@
1
- export var ELoanChargeType;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ELoanChargeType = void 0;
4
+ var ELoanChargeType;
2
5
  (function (ELoanChargeType) {
3
6
  ELoanChargeType["INTEREST_FEE"] = "INTEREST_FEE";
4
7
  ELoanChargeType["ADMIN_FEE"] = "ADMIN_FEE";
@@ -6,4 +9,4 @@ export var ELoanChargeType;
6
9
  ELoanChargeType["ANNUAL_LINE_FEE"] = "ANNUAL_LINE_FEE";
7
10
  ELoanChargeType["WIRE_FEE"] = "WIRE_FEE";
8
11
  ELoanChargeType["OTHER"] = "OTHER";
9
- })(ELoanChargeType || (ELoanChargeType = {}));
12
+ })(ELoanChargeType || (exports.ELoanChargeType = ELoanChargeType = {}));
@@ -1,16 +1,19 @@
1
- export var ELoanTypes;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EChargeCalculationBasis = exports.EChargeFrequencies = exports.ELoanTypes = void 0;
4
+ var ELoanTypes;
2
5
  (function (ELoanTypes) {
3
6
  ELoanTypes["REVOLVER"] = "REVOLVER";
4
7
  ELoanTypes["TERM"] = "TERM";
5
- })(ELoanTypes || (ELoanTypes = {}));
6
- export var EChargeFrequencies;
8
+ })(ELoanTypes || (exports.ELoanTypes = ELoanTypes = {}));
9
+ var EChargeFrequencies;
7
10
  (function (EChargeFrequencies) {
8
11
  EChargeFrequencies["DAILY"] = "DAILY";
9
12
  EChargeFrequencies["MONTHLY"] = "MONTHLY";
10
13
  EChargeFrequencies["ANNUAL"] = "ANNUAL";
11
14
  EChargeFrequencies["DISBURSEMENT"] = "DISBURSEMENT";
12
- })(EChargeFrequencies || (EChargeFrequencies = {}));
13
- export var EChargeCalculationBasis;
15
+ })(EChargeFrequencies || (exports.EChargeFrequencies = EChargeFrequencies = {}));
16
+ var EChargeCalculationBasis;
14
17
  (function (EChargeCalculationBasis) {
15
18
  EChargeCalculationBasis["DAILY_BALANCE"] = "DAILY_BALANCE";
16
19
  EChargeCalculationBasis["AVERAGE_MONTHLY_BALANCE"] = "AVERAGE_MONTHLY_BALANCE";
@@ -18,4 +21,4 @@ export var EChargeCalculationBasis;
18
21
  EChargeCalculationBasis["COMMITMENT"] = "COMMITMENT";
19
22
  EChargeCalculationBasis["DISBURSEMENT_AMOUNT"] = "DISBURSEMENT_AMOUNT";
20
23
  EChargeCalculationBasis["ONE_TIME"] = "ONE_TIME";
21
- })(EChargeCalculationBasis || (EChargeCalculationBasis = {}));
24
+ })(EChargeCalculationBasis || (exports.EChargeCalculationBasis = EChargeCalculationBasis = {}));
@@ -1,4 +1,7 @@
1
- export var EModules;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EModules = void 0;
4
+ var EModules;
2
5
  (function (EModules) {
3
6
  EModules["ACCOUNTING"] = "accounting";
4
7
  EModules["ADMIN"] = "admin";
@@ -10,4 +13,4 @@ export var EModules;
10
13
  EModules["COMPLIANCE"] = "compliance";
11
14
  EModules["LOAN_CHARGES"] = "loan-charges";
12
15
  EModules["LOAN_DETAILS"] = "loan-details";
13
- })(EModules || (EModules = {}));
16
+ })(EModules || (exports.EModules = EModules = {}));
@@ -1,4 +1,7 @@
1
- export var EReserveTypes;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EReserveTypes = void 0;
4
+ var EReserveTypes;
2
5
  (function (EReserveTypes) {
3
6
  EReserveTypes["RENT"] = "RENT";
4
7
  EReserveTypes["PAYROLL"] = "PAYROLL";
@@ -8,4 +11,4 @@ export var EReserveTypes;
8
11
  EReserveTypes["RECEIVABLES"] = "RECEIVABLES";
9
12
  EReserveTypes["EQUIPMENT"] = "EQUIPMENT";
10
13
  EReserveTypes["OTHER"] = "OTHER";
11
- })(EReserveTypes || (EReserveTypes = {}));
14
+ })(EReserveTypes || (exports.EReserveTypes = EReserveTypes = {}));
@@ -1,5 +1,8 @@
1
- export var EUploadTypes;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EUploadTypes = void 0;
4
+ var EUploadTypes;
2
5
  (function (EUploadTypes) {
3
6
  EUploadTypes["BBC"] = "BBC";
4
7
  EUploadTypes["BANKS"] = "BANKS";
5
- })(EUploadTypes || (EUploadTypes = {}));
8
+ })(EUploadTypes || (exports.EUploadTypes = EUploadTypes = {}));
@@ -1,8 +1,11 @@
1
- export var EUserRoles;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EUserRoles = void 0;
4
+ var EUserRoles;
2
5
  (function (EUserRoles) {
3
6
  EUserRoles["ADMIN"] = "admin";
4
7
  EUserRoles["USER"] = "user";
5
8
  EUserRoles["USER_EXTERNAL"] = "user-external";
6
9
  EUserRoles["READ_ONLY"] = "read-only";
7
10
  EUserRoles["RESTRICTED"] = "restricted";
8
- })(EUserRoles || (EUserRoles = {}));
11
+ })(EUserRoles || (exports.EUserRoles = EUserRoles = {}));
@@ -1,8 +1,11 @@
1
- export var EValidators;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EValidators = void 0;
4
+ var EValidators;
2
5
  (function (EValidators) {
3
6
  EValidators[EValidators["NOT_EMPTY"] = 0] = "NOT_EMPTY";
4
7
  EValidators[EValidators["IS_NUMBER"] = 1] = "IS_NUMBER";
5
8
  EValidators[EValidators["NUMBER_GT_NULL"] = 2] = "NUMBER_GT_NULL";
6
9
  EValidators[EValidators["NUMBER_GTE_NULL"] = 3] = "NUMBER_GTE_NULL";
7
10
  EValidators[EValidators["IS_DATE"] = 4] = "IS_DATE";
8
- })(EValidators || (EValidators = {}));
11
+ })(EValidators || (exports.EValidators = EValidators = {}));
@@ -1,133 +1,136 @@
1
- import { ECollaterals, EDataTypes, EValidators } from '../enums';
2
- export const COLLATERALS = {
3
- [ECollaterals.INVENTORY]: [
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertIntoDates = exports.COLLATERALS = void 0;
4
+ const enums_1 = require("../enums");
5
+ exports.COLLATERALS = {
6
+ [enums_1.ECollaterals.INVENTORY]: [
4
7
  {
5
8
  db_title: 'bbcDate',
6
9
  title: 'BBC date',
7
10
  required: false,
8
11
  items: [],
9
12
  hidden: true,
10
- validators: [EValidators.NOT_EMPTY, EValidators.IS_DATE],
11
- dataType: EDataTypes.DATE,
13
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_DATE],
14
+ dataType: enums_1.EDataTypes.DATE,
12
15
  },
13
16
  {
14
17
  db_title: 'skuDate',
15
18
  title: 'SKU date',
16
19
  required: false,
17
20
  items: [],
18
- validators: [EValidators.IS_DATE],
21
+ validators: [enums_1.EValidators.IS_DATE],
19
22
  isDate: true,
20
- dataType: EDataTypes.DATE,
23
+ dataType: enums_1.EDataTypes.DATE,
21
24
  },
22
25
  {
23
26
  db_title: 'sku',
24
27
  title: 'SKU',
25
28
  required: true,
26
29
  items: [],
27
- validators: [EValidators.NOT_EMPTY],
28
- dataType: EDataTypes.STRING,
30
+ validators: [enums_1.EValidators.NOT_EMPTY],
31
+ dataType: enums_1.EDataTypes.STRING,
29
32
  },
30
- { db_title: 'lotNumber', title: '#LOT', required: false, items: [], dataType: EDataTypes.STRING },
31
- { db_title: 'category', title: 'Category', required: false, items: [], dataType: EDataTypes.STRING },
33
+ { db_title: 'lotNumber', title: '#LOT', required: false, items: [], dataType: enums_1.EDataTypes.STRING },
34
+ { db_title: 'category', title: 'Category', required: false, items: [], dataType: enums_1.EDataTypes.STRING },
32
35
  {
33
36
  db_title: 'qty',
34
37
  title: 'Qty',
35
38
  required: false,
36
39
  items: [],
37
- validators: [EValidators.NOT_EMPTY, EValidators.IS_NUMBER],
38
- dataType: EDataTypes.NUMBER,
40
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_NUMBER],
41
+ dataType: enums_1.EDataTypes.NUMBER,
39
42
  },
40
43
  {
41
44
  db_title: 'unitCost',
42
45
  title: 'Unit cost',
43
46
  required: false,
44
47
  items: [],
45
- validators: [EValidators.IS_NUMBER],
46
- dataType: EDataTypes.NUMBER,
48
+ validators: [enums_1.EValidators.IS_NUMBER],
49
+ dataType: enums_1.EDataTypes.NUMBER,
47
50
  },
48
51
  {
49
52
  db_title: 'value',
50
53
  title: 'Value',
51
54
  required: true,
52
55
  items: [],
53
- validators: [EValidators.NOT_EMPTY, EValidators.IS_NUMBER],
54
- dataType: EDataTypes.NUMBER,
56
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_NUMBER],
57
+ dataType: enums_1.EDataTypes.NUMBER,
55
58
  },
56
59
  {
57
60
  db_title: 'expiryDate',
58
61
  title: 'Expiry date',
59
62
  required: false,
60
63
  items: [],
61
- validators: [EValidators.IS_DATE],
64
+ validators: [enums_1.EValidators.IS_DATE],
62
65
  isDate: true,
63
- dataType: EDataTypes.DATE,
66
+ dataType: enums_1.EDataTypes.DATE,
64
67
  },
65
- { db_title: 'location', title: 'Location', required: false, items: [], dataType: EDataTypes.STRING },
68
+ { db_title: 'location', title: 'Location', required: false, items: [], dataType: enums_1.EDataTypes.STRING },
66
69
  {
67
70
  db_title: 'skuDescription1',
68
71
  title: 'SKU Description 1',
69
72
  required: false,
70
73
  items: [],
71
- dataType: EDataTypes.STRING,
74
+ dataType: enums_1.EDataTypes.STRING,
72
75
  },
73
76
  {
74
77
  db_title: 'skuDescription2',
75
78
  title: 'SKU Description 2',
76
79
  required: false,
77
80
  items: [],
78
- dataType: EDataTypes.STRING,
81
+ dataType: enums_1.EDataTypes.STRING,
79
82
  },
80
83
  {
81
84
  db_title: 'skuDescription3',
82
85
  title: 'SKU Description 3',
83
86
  required: false,
84
87
  items: [],
85
- dataType: EDataTypes.STRING,
88
+ dataType: enums_1.EDataTypes.STRING,
86
89
  },
87
90
  {
88
91
  db_title: 'detail1',
89
92
  title: 'Detail 1',
90
93
  required: false,
91
94
  items: [],
92
- dataType: EDataTypes.STRING,
95
+ dataType: enums_1.EDataTypes.STRING,
93
96
  },
94
97
  {
95
98
  db_title: 'detail2',
96
99
  title: 'Detail 2',
97
100
  required: false,
98
101
  items: [],
99
- dataType: EDataTypes.STRING,
102
+ dataType: enums_1.EDataTypes.STRING,
100
103
  },
101
104
  {
102
105
  db_title: 'detail3',
103
106
  title: 'Detail 3',
104
107
  required: false,
105
108
  items: [],
106
- dataType: EDataTypes.STRING,
109
+ dataType: enums_1.EDataTypes.STRING,
107
110
  },
108
111
  ],
109
- [ECollaterals.RECEIVABLE]: [
112
+ [enums_1.ECollaterals.RECEIVABLE]: [
110
113
  {
111
114
  db_title: 'bbcDate',
112
115
  title: 'BBC date',
113
116
  required: false,
114
117
  items: [],
115
118
  hidden: true,
116
- validators: [EValidators.NOT_EMPTY, EValidators.IS_DATE],
119
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_DATE],
117
120
  },
118
121
  {
119
122
  db_title: 'invoiceNumber',
120
123
  title: 'Invoice number',
121
124
  required: true,
122
125
  items: [],
123
- validators: [EValidators.NOT_EMPTY],
126
+ validators: [enums_1.EValidators.NOT_EMPTY],
124
127
  },
125
128
  {
126
129
  db_title: 'invoiceDate',
127
130
  title: 'Invoice date',
128
131
  required: true,
129
132
  items: [],
130
- validators: [EValidators.NOT_EMPTY, EValidators.IS_DATE],
133
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_DATE],
131
134
  isDate: true,
132
135
  },
133
136
  {
@@ -135,21 +138,21 @@ export const COLLATERALS = {
135
138
  title: 'Customer title',
136
139
  required: true,
137
140
  items: [],
138
- validators: [EValidators.NOT_EMPTY],
141
+ validators: [enums_1.EValidators.NOT_EMPTY],
139
142
  },
140
143
  {
141
144
  db_title: 'invoiceAmount',
142
145
  title: 'Invoice amount',
143
146
  required: true,
144
147
  items: [],
145
- validators: [EValidators.NOT_EMPTY, EValidators.IS_NUMBER],
148
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_NUMBER],
146
149
  },
147
150
  {
148
151
  db_title: 'originalAmount',
149
152
  title: 'Original amount',
150
153
  required: false,
151
154
  items: [],
152
- validators: [EValidators.IS_NUMBER],
155
+ validators: [enums_1.EValidators.IS_NUMBER],
153
156
  },
154
157
  { db_title: 'dueDate', title: 'Due date', required: false, items: [], isDate: true },
155
158
  {
@@ -171,20 +174,20 @@ export const COLLATERALS = {
171
174
  items: [],
172
175
  },
173
176
  ],
174
- [ECollaterals.ACCOUNT_PAYABLE]: [
177
+ [enums_1.ECollaterals.ACCOUNT_PAYABLE]: [
175
178
  {
176
179
  db_title: 'bbcDate',
177
180
  title: 'BBC date',
178
181
  required: false,
179
182
  items: [],
180
- validators: [EValidators.NOT_EMPTY, EValidators.IS_DATE],
183
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_DATE],
181
184
  },
182
185
  {
183
186
  db_title: 'apDate',
184
187
  title: 'AP date',
185
188
  required: false,
186
189
  items: [],
187
- validators: [EValidators.NOT_EMPTY, EValidators.IS_DATE],
190
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_DATE],
188
191
  isDate: true,
189
192
  },
190
193
  { db_title: 'poNumber', title: 'PO number', required: false, items: [] },
@@ -194,7 +197,7 @@ export const COLLATERALS = {
194
197
  title: 'Amount',
195
198
  required: true,
196
199
  items: [],
197
- validators: [EValidators.NOT_EMPTY, EValidators.IS_NUMBER, EValidators.NUMBER_GT_NULL],
200
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_NUMBER, enums_1.EValidators.NUMBER_GT_NULL],
198
201
  },
199
202
  { db_title: 'otherInformation1', title: 'Other Information 1', required: false, items: [] },
200
203
  { db_title: 'otherInformation2', title: 'Other Information 2', required: false, items: [] },
@@ -206,7 +209,7 @@ export const COLLATERALS = {
206
209
  title: 'Transaction date',
207
210
  required: true,
208
211
  items: [],
209
- validators: [EValidators.NOT_EMPTY, EValidators.IS_DATE],
212
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_DATE],
210
213
  isDate: true,
211
214
  },
212
215
  {
@@ -214,28 +217,28 @@ export const COLLATERALS = {
214
217
  title: 'Ledger account code',
215
218
  required: true,
216
219
  items: [],
217
- validators: [EValidators.NOT_EMPTY],
220
+ validators: [enums_1.EValidators.NOT_EMPTY],
218
221
  },
219
222
  {
220
223
  db_title: 'amount',
221
224
  title: 'Amount',
222
225
  required: true,
223
226
  items: [],
224
- validators: [EValidators.NOT_EMPTY, EValidators.IS_NUMBER],
227
+ validators: [enums_1.EValidators.NOT_EMPTY, enums_1.EValidators.IS_NUMBER],
225
228
  },
226
229
  {
227
230
  db_title: 'description',
228
231
  title: 'Description',
229
232
  required: true,
230
233
  items: [],
231
- validators: [EValidators.NOT_EMPTY],
234
+ validators: [enums_1.EValidators.NOT_EMPTY],
232
235
  },
233
236
  {
234
237
  db_title: 'reference',
235
238
  title: 'Reference',
236
239
  required: true,
237
240
  items: [],
238
- validators: [EValidators.NOT_EMPTY],
241
+ validators: [enums_1.EValidators.NOT_EMPTY],
239
242
  },
240
243
  {
241
244
  db_title: 'customerId',
@@ -249,22 +252,22 @@ export const COLLATERALS = {
249
252
  title: 'Bank account number',
250
253
  required: true,
251
254
  items: [],
252
- validators: [EValidators.NOT_EMPTY],
255
+ validators: [enums_1.EValidators.NOT_EMPTY],
253
256
  },
254
257
  {
255
258
  db_title: 'transactionType',
256
259
  title: 'Transaction type',
257
260
  required: false,
258
261
  items: [],
259
- validators: [EValidators.NOT_EMPTY],
262
+ validators: [enums_1.EValidators.NOT_EMPTY],
260
263
  hidden: true,
261
264
  },
262
265
  ],
263
266
  };
264
- export const convertIntoDates = (item, collateralType) => {
267
+ const convertIntoDates = (item, collateralType) => {
265
268
  return Object.keys(item).reduce((acc, key) => {
266
- const foundColumn = COLLATERALS[collateralType].find((c) => c.db_title === key);
267
- if (!!foundColumn && !!foundColumn.validators && foundColumn.validators.includes(EValidators.IS_DATE)) {
269
+ const foundColumn = exports.COLLATERALS[collateralType].find((c) => c.db_title === key);
270
+ if (!!foundColumn && !!foundColumn.validators && foundColumn.validators.includes(enums_1.EValidators.IS_DATE)) {
268
271
  if (!!item[key]) {
269
272
  const newDate = new Date(item[key]);
270
273
  if (newDate instanceof Date && !isNaN(newDate.valueOf())) {
@@ -275,3 +278,4 @@ export const convertIntoDates = (item, collateralType) => {
275
278
  return item;
276
279
  }, item);
277
280
  };
281
+ exports.convertIntoDates = convertIntoDates;
@@ -1,5 +1,12 @@
1
- import _ from 'lodash';
2
- export const createFilteredObject = (originalObject, inclusionList) => {
3
- const filteredObject = _.pick(originalObject, inclusionList);
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createFilteredObject = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const createFilteredObject = (originalObject, inclusionList) => {
9
+ const filteredObject = lodash_1.default.pick(originalObject, inclusionList);
4
10
  return filteredObject;
5
11
  };
12
+ exports.createFilteredObject = createFilteredObject;