From 9434c4a188e5068a79603e89b97ea39013f1766b Mon Sep 17 00:00:00 2001 From: Rizky Date: Sun, 7 Jul 2024 08:08:13 +0700 Subject: [PATCH] fix --- pkgs/utils/query.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/utils/query.ts b/pkgs/utils/query.ts index 4194884..4c2e74a 100644 --- a/pkgs/utils/query.ts +++ b/pkgs/utils/query.ts @@ -24,7 +24,6 @@ export const execQuery = async (args: DBArg, prisma: any) => { mode: "field" | "relation"; }; }; - console.log(arg); if (arg) { const { table, where, data } = arg; const mode = arg.mode || "field"; @@ -32,8 +31,14 @@ export const execQuery = async (args: DBArg, prisma: any) => { const transactions = []; const schema_path = dir("app/db/prisma/schema.prisma"); + console.log("a", schema_path); + const schema = createPrismaSchemaBuilder(await readAsync(schema_path)); + console.log("b"); + const schema_table = schema.findByType("model", { name: table }); + + console.log(schema_table); const tables = schema .findAllByType("model", {}) .map((e) => e?.name) as string[];