Add an SQL DB abstraction layer

Because what self-respecting Enterprise(R) project doesn't have
one of those?
This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 2ccd9dc382
commit 3e6b4f4798
32 changed files with 440 additions and 541 deletions
+5 -1
View File
@@ -3,6 +3,8 @@ import logger from "debug";
import { Repositories } from "./repo";
import * as Req from "./request";
import * as Res from "./response";
import { Transaction } from "../sql";
import { SqlRepositories } from "./db";
const debug = logger("app:aimedb:ops");
@@ -101,10 +103,12 @@ function log(
}
export async function dispatch(
rep: Repositories,
txn: Transaction,
req: Req.AimeRequest,
now: Date
): Promise<Res.AimeResponse | undefined> {
const rep = new SqlRepositories(txn);
switch (req.type) {
case "hello":
return hello(rep, req, now);