From 34a3f2f132791ad33e6a6b59371bb6f029436ab4 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 18 Jul 2020 16:51:55 +0200 Subject: Tests and abc fix using Lars' branch --- src/db/DBController.ts | 16 ++++++++++------ src/db/user.ts | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/db') diff --git a/src/db/DBController.ts b/src/db/DBController.ts index 2cfd1f2..c01d7b4 100644 --- a/src/db/DBController.ts +++ b/src/db/DBController.ts @@ -34,10 +34,10 @@ export default class DBController { } } - async execute(query: string) { + async execute(query: string, params?: string[]) { if (this.client) { try { - return await this.client.execute(query); + return await this.client.execute(query, params); } catch (e) { throw e; } @@ -45,11 +45,15 @@ export default class DBController { } async execute_multiple(queries: string[]) { - await this.client!.transaction(async (conn) => { - queries.forEach(async (query) => { - await conn.execute(query); + try { + return await this.client!.transaction(async (conn) => { + queries.forEach(async (query) => { + await conn.execute(query); + }); }); - }); + } catch (e) { + throw e; + } } async close() { diff --git a/src/db/user.ts b/src/db/user.ts index c245b5f..1e20564 100644 --- a/src/db/user.ts +++ b/src/db/user.ts @@ -1,6 +1,7 @@ import DBController from "./DBController.ts"; -class User extends DBController { +class User { + createUser() {} } export default new User(); -- cgit v1.2.3