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,18 +1,15 @@
import { Table } from "dexie";
export type Account = {
id?: number;
publicKey: string;
mnemonic: string;
id?: number; // auto-generated by Dexie
dateCreated: Date;
derivationPath: string;
identity: string;
dateCreated: number;
};
export type AccountsTable = {
accounts: Table<Account>;
publicKeyHex: string;
mnemonic: string;
};
// mark encrypted field by starting with a $ character
// see https://github.com/PVermeer/dexie-addon-suite-monorepo/tree/master/packages/dexie-encrypted-addon
export const accountsSchema = {
accounts: "++id, publicKey, $mnemonic, $identity, dateCreated",
accounts:
"++id, dateCreated, derivationPath, $identity, $mnemonic, publicKeyHex",
};