This commit is contained in:
Rizky 2024-06-28 04:02:46 -07:00
parent db651e9894
commit ba50953cbb
1 changed files with 4 additions and 3 deletions

View File

@ -43,9 +43,6 @@ async (opt) => {
${opt?.before_load ? opt.before_load : `let id = raw_id`} ${opt?.before_load ? opt.before_load : `let id = raw_id`}
let item = {}; let item = {};
let where = {
${pk}: id,
};
if (id){ if (id){
//@ts-ignore //@ts-ignore
const table = db[gen__table] as any; const table = db[gen__table] as any;
@ -57,6 +54,10 @@ async (opt) => {
if (pk && pk.type === "int") id = parseInt(id); if (pk && pk.type === "int") id = parseInt(id);
} }
let where = {
${pk}: id,
};
const gen = generateSelect(fields); const gen = generateSelect(fields);
item = await table?.findFirst({ item = await table?.findFirst({
where, where,