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