From d1597ed8daec78582a53e40a2f6100d662bc1dd0 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Thu, 25 Jan 2024 17:09:30 -0500 Subject: [PATCH] find by id of ormify patch --- backend-pg/src/lib/knex/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend-pg/src/lib/knex/index.ts b/backend-pg/src/lib/knex/index.ts index c8e81541f..0a47c7161 100644 --- a/backend-pg/src/lib/knex/index.ts +++ b/backend-pg/src/lib/knex/index.ts @@ -50,11 +50,12 @@ export const ormify = ( const res = await cb(trx); return res; }), - findById: (id: string, tx?: Knex) => { + findById: async (id: string, tx?: Knex) => { try { - return (tx || db)(tableName) + const result = await (tx || db)(tableName) .where({ id } as any) .first("*"); + return result; } catch (error) { throw new DatabaseError({ error, name: "Find by id" }); } @@ -64,6 +65,7 @@ export const ormify = ( const res = await (tx || db)(tableName).where(filter).first("*"); return res; } catch (error) { + console.log("I HAVE REACHEd HEREEE===>", tableName) throw new DatabaseError({ error, name: "Find one" }); } }, @@ -83,6 +85,7 @@ export const ormify = ( const res = await query; return res; } catch (error) { + console.log("I HAVE REACHEd HEREEE===>", tableName) throw new DatabaseError({ error, name: "Find one" }); } },