wip fix
This commit is contained in:
+8
-4
@@ -14,15 +14,18 @@ export const execQuery = async (args: DBArg, prisma: any) => {
|
|||||||
const { table, action, params } = args;
|
const { table, action, params } = args;
|
||||||
|
|
||||||
if (action === "batch_update") {
|
if (action === "batch_update") {
|
||||||
const { batch } = params as unknown as {
|
const { table, batch } = params as unknown as {
|
||||||
table: string;
|
table?: { table: string; data: any; where: any }[];
|
||||||
batch: { table: string; data: any; where: any }[];
|
batch?: { table: string; data: any; where: any }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const promises = [] as any[];
|
const promises = [] as any[];
|
||||||
|
|
||||||
|
const b = table || batch;
|
||||||
|
|
||||||
|
if (b) {
|
||||||
try {
|
try {
|
||||||
for (const item of batch) {
|
for (const item of b) {
|
||||||
if (
|
if (
|
||||||
item.table &&
|
item.table &&
|
||||||
Object.entries(item.where).length > 0 &&
|
Object.entries(item.where).length > 0 &&
|
||||||
@@ -40,6 +43,7 @@ export const execQuery = async (args: DBArg, prisma: any) => {
|
|||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
throw new Error(e.message);
|
throw new Error(e.message);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user