Updates
This commit is contained in:
@@ -2,6 +2,7 @@ import _ from "lodash";
|
||||
import serverError from "../../backend/serverError";
|
||||
import runQuery, { DbContextsArray } from "../../backend/db/runQuery";
|
||||
import { DSQL_DatabaseSchemaType, PostReturn } from "../../../types";
|
||||
import debugLog from "../../../utils/logging/debug-log";
|
||||
|
||||
type Param = {
|
||||
query: any;
|
||||
@@ -11,6 +12,7 @@ type Param = {
|
||||
dbSchema?: DSQL_DatabaseSchemaType;
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
forceLocal?: boolean;
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -24,6 +26,7 @@ export default async function apiPost({
|
||||
dbSchema,
|
||||
dbContext,
|
||||
forceLocal,
|
||||
debug,
|
||||
}: Param): Promise<PostReturn> {
|
||||
if (typeof query === "string" && query?.match(/^create |^alter |^drop /i)) {
|
||||
return { success: false, msg: "Wrong Input" };
|
||||
@@ -54,6 +57,20 @@ export default async function apiPost({
|
||||
forceLocal,
|
||||
});
|
||||
|
||||
if (debug) {
|
||||
debugLog({
|
||||
log: result,
|
||||
addTime: true,
|
||||
label: "result",
|
||||
});
|
||||
|
||||
debugLog({
|
||||
log: query,
|
||||
addTime: true,
|
||||
label: "query",
|
||||
});
|
||||
}
|
||||
|
||||
results = result;
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
Reference in New Issue
Block a user