Updates
This commit is contained in:
@@ -40,8 +40,7 @@ export default async function dbHandler<
|
||||
results = queryResults[0];
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.log("Connection Info =>", CONNECTION?.info);
|
||||
|
||||
// console.log("Connection Info =>", JSON.stringify(CONNECTION?.info));
|
||||
if (
|
||||
error.message &&
|
||||
typeof error.message == "string" &&
|
||||
@@ -51,7 +50,10 @@ export default async function dbHandler<
|
||||
}
|
||||
|
||||
if (!noErrorLogs) {
|
||||
console.log("ERROR in dbHandler =>", error.message);
|
||||
// console.log("ERROR in dbHandler =>", error.message);
|
||||
// console.log(".........................................");
|
||||
// console.log(".........................................");
|
||||
// console.log(".........................................");
|
||||
console.log(error);
|
||||
|
||||
const tmpFolder = path.resolve(process.cwd(), "./.tmp");
|
||||
|
||||
@@ -3,6 +3,7 @@ import { DSQL_TableSchemaType, UserType } from "../../types";
|
||||
import grabMariadbMainUserForUser from "./grab-mariadb-main-user-for-user";
|
||||
import connDbHandler from "../../utils/db/conn-db-handler";
|
||||
import grabDbSSL from "../../utils/backend/grabDbSSL";
|
||||
import _ from "lodash";
|
||||
|
||||
type Params = {
|
||||
query?: string;
|
||||
@@ -40,5 +41,30 @@ export default async function userDbHandler({
|
||||
|
||||
const results = await connDbHandler(connection, query);
|
||||
|
||||
if (Array.isArray(results)) {
|
||||
const parsedDbResults = results.map((res) => parseResultObject(res));
|
||||
return parsedDbResults;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseResultObject(res: any) {
|
||||
if (typeof res !== "object") return res;
|
||||
if (!res) return res;
|
||||
|
||||
const newRes = _.cloneDeep(res);
|
||||
|
||||
const resKeys = Object.keys(res);
|
||||
|
||||
for (let i = 0; i < resKeys.length; i++) {
|
||||
const k = resKeys[i];
|
||||
const val = newRes[k];
|
||||
|
||||
if (typeof val == "object" && val) {
|
||||
newRes[k] = "";
|
||||
}
|
||||
}
|
||||
|
||||
return newRes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user