From dc06a9652fdf13ca644d4d3209f3c578eed577be Mon Sep 17 00:00:00 2001 From: Tau Date: Mon, 29 Apr 2019 15:52:31 -0400 Subject: [PATCH] wip fix profile create id propagation --- src/aimedb/index.ts | 4 ++-- src/idz/db/profile.ts | 8 ++++---- src/idz/handler/createProfile.ts | 2 +- src/idz/index.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/aimedb/index.ts b/src/aimedb/index.ts index f378acf..8aa6c5c 100644 --- a/src/aimedb/index.ts +++ b/src/aimedb/index.ts @@ -24,10 +24,10 @@ export default async function aimedb(socket: Socket) { } } - txn.commit(); + await txn.commit(); } catch (e) { console.log("Aimedb: Connection error:\n", e); - txn.rollback(); + await txn.rollback(); } console.log("Aimedb: Connection closed\n"); diff --git a/src/idz/db/profile.ts b/src/idz/db/profile.ts index 6593c7b..385a960 100644 --- a/src/idz/db/profile.ts +++ b/src/idz/db/profile.ts @@ -40,9 +40,9 @@ export class SqlProfileRepository implements ProfileRepository { if (row === undefined) { return undefined; - } else { - return _extractRow(row); } + + return _extractRow(row); } async discoverByAimeId(aimeId: AimeId): Promise { @@ -63,8 +63,8 @@ export class SqlProfileRepository implements ProfileRepository { async load(extId: ExtId): Promise { const loadSql = sql - .select() - .from("idz.profile") + .select("p.*") + .from("idz.profile p") .where("ext_id", extId) .toParams(); diff --git a/src/idz/handler/createProfile.ts b/src/idz/handler/createProfile.ts index c8de754..bc26cff 100644 --- a/src/idz/handler/createProfile.ts +++ b/src/idz/handler/createProfile.ts @@ -46,6 +46,6 @@ export async function createProfile( return { type: "generic_res", - status: 1, + status: profileId, // "Generic response" my fucking *ass* }; } diff --git a/src/idz/index.ts b/src/idz/index.ts index 98866f8..d3ac8da 100644 --- a/src/idz/index.ts +++ b/src/idz/index.ts @@ -15,10 +15,10 @@ export default async function idz(socket: Socket) { output.write(await dispatch(txn, req)); } - txn.commit(); + await txn.commit(); } catch (e) { console.log("Idz: Error:", e); - txn.rollback(); + await txn.rollback(); } console.log("Idz: Connection closed\n");