diff --git a/backend/src/db.ts b/backend/src/db.ts index b745126..adfd286 100644 --- a/backend/src/db.ts +++ b/backend/src/db.ts @@ -1,6 +1,10 @@ -import { Pool } from "pg"; +import { Pool, types } from "pg"; // "types" importieren import { config } from "./config"; +types.setTypeParser(1700, (val) => parseFloat(val)); +types.setTypeParser(20, (val) => parseInt(val, 10)); + + export const pool = new Pool({ connectionString: config.databaseUrl }); @@ -9,4 +13,4 @@ export const pool = new Pool({ export async function query(text: string, params?: any[]): Promise { const res = await pool.query(text, params); return res.rows as T[]; -} +} \ No newline at end of file