add status to invoices

This commit is contained in:
Dzmitry_Tamashevich@epam.com
2020-10-27 10:51:04 +03:00
committed by Daniel Hutzel
parent 9a63f406ec
commit 52f00c62b7
5 changed files with 23 additions and 5 deletions

View File

@@ -12,6 +12,12 @@ const SRC_STORAGE_NAME = args[FIRST_INDEX];
const TARGET_STORAGE_NAME = args[SECOND_INDEX];
const TARGET_SCHEMA_PATH = args[THIRD_INDEX];
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const camelCaseToSnake = (str) =>
str.replace(
/[a-z][A-Z]/g,
@@ -120,6 +126,14 @@ const logProcessArgs = () => {
password: "some",
}));
}
// for mock invoice data
if (srcEntityName === "Invoices") {
columns.push("status");
srcResultRows = srcResultRows.map((row) => ({
...row,
status: getRandomInt(-1, 2),
}));
}
const transaction = await targetStorage.tx();
await transaction.run(