add mocked auth

This commit is contained in:
Dzmitry_Tamashevich@epam.com
2020-10-15 01:24:12 +03:00
committed by Daniel Hutzel
parent 937d9caf2b
commit 49f6b8c060
30 changed files with 151 additions and 271 deletions

View File

@@ -89,7 +89,7 @@ const logProcessArgs = () => {
const insertQuery = constructInsertQuery(targetEntityName, targetColumns);
const srcEntityName = camelCaseToSnake(targetEntityName.split(".").pop());
const srcResultRows = await srcStorage.read(srcEntityName); // e.g. [ { AlbumId:1, ArtistId:1, Title:'some' }, ... ]
let srcResultRows = await srcStorage.read(srcEntityName); // e.g. [ { AlbumId:1, ArtistId:1, Title:'some' }, ... ]
if (!srcResultRows || srcResultRows.length < ZERO_VALUE) {
console.log(
`[LOG] Skipping ${targetEntityName}.
@@ -106,6 +106,15 @@ const logProcessArgs = () => {
);
}
// for mock auth
if (srcEntityName === "Employees" || srcEntityName === "Customers") {
columns.push("password");
srcResultRows = srcResultRows.map((row) => ({
...row,
password: "some",
}));
}
const transaction = await targetStorage.tx();
await transaction.run(
srcResultRows.map((row) => insertQuery(Object.values(row), columns))