Updates
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
|
||||
import _ from "lodash";
|
||||
import serverError from "../../backend/serverError";
|
||||
import runQuery from "../../backend/db/runQuery";
|
||||
import runQuery, { DbContextsArray } from "../../backend/db/runQuery";
|
||||
import {
|
||||
DSQL_TableSchemaType,
|
||||
GetReturn,
|
||||
ServerQueryParam,
|
||||
} from "../../../types";
|
||||
import apiGetGrabQueryAndValues from "../../../../utils/get/(utils)/grab-query-and-values";
|
||||
import apiGetGrabQueryAndValues from "../../../utils/grab-query-and-values";
|
||||
|
||||
type Param = {
|
||||
query:
|
||||
@@ -22,6 +22,7 @@ type Param = {
|
||||
tableName?: string;
|
||||
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
|
||||
debug?: boolean;
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ export default async function apiGet({
|
||||
tableName,
|
||||
dbSchema,
|
||||
debug,
|
||||
dbContext,
|
||||
}: Param): Promise<import("../../../types").GetReturn> {
|
||||
const queryAndValues = apiGetGrabQueryAndValues({
|
||||
query,
|
||||
@@ -57,6 +59,8 @@ export default async function apiGet({
|
||||
readOnly: true,
|
||||
dbSchema,
|
||||
tableName,
|
||||
dbContext,
|
||||
debug,
|
||||
});
|
||||
|
||||
if (debug && global.DSQL_USE_LOCAL) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ from "lodash";
|
||||
import serverError from "../../backend/serverError";
|
||||
import runQuery from "../../backend/db/runQuery";
|
||||
import runQuery, { DbContextsArray } from "../../backend/db/runQuery";
|
||||
import { DSQL_DatabaseSchemaType, PostReturn } from "../../../types";
|
||||
|
||||
type Param = {
|
||||
@@ -9,6 +9,7 @@ type Param = {
|
||||
dbFullName: string;
|
||||
tableName?: string;
|
||||
dbSchema?: DSQL_DatabaseSchemaType;
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,7 @@ export default async function apiPost({
|
||||
queryValues,
|
||||
tableName,
|
||||
dbSchema,
|
||||
dbContext,
|
||||
}: Param): Promise<PostReturn> {
|
||||
if (typeof query === "string" && query?.match(/^create |^alter |^drop /i)) {
|
||||
return { success: false, msg: "Wrong Input" };
|
||||
@@ -47,6 +49,7 @@ export default async function apiPost({
|
||||
dbSchema: dbSchema,
|
||||
queryValuesArray: queryValues,
|
||||
tableName,
|
||||
dbContext,
|
||||
});
|
||||
|
||||
results = result;
|
||||
|
||||
Reference in New Issue
Block a user