refactor DB organization (prepping for more tables)

This commit is contained in:
2023-03-18 17:04:14 -06:00
parent 53204179a2
commit cfeabf05a4
6 changed files with 48 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
import BaseDexie from "dexie";
import BaseDexie, { Table } from "dexie";
import { encrypted, Encryption } from "@pvermeer/dexie-encrypted-addon";
import { accountsSchema, AccountsTable } from "./tables/accounts";
import { Account, accountsSchema } from "./tables/accounts";
/**
* In order to make the next line be acceptable, the program needs to have its linter suppress a rule:
@@ -10,9 +10,11 @@ import { accountsSchema, AccountsTable } from "./tables/accounts";
*
* https://9to5answer.com/how-to-bypass-warning-unexpected-any-specify-a-different-type-typescript-eslint-no-explicit-any
*/
type DexieTables = AccountsTable;
type DexieTables = {
accounts: Table<Account>;
};
export type Dexie<T extends unknown = DexieTables> = BaseDexie & T;
export const db = new BaseDexie("kickStarter") as Dexie;
export const db = new BaseDexie("KickStart") as Dexie;
const schema = Object.assign({}, accountsSchema);
/**