From 4486bcb35657fa0e4c1e506e57d74e04588a7a69 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Thu, 12 Sep 2019 11:34:41 +0200 Subject: [PATCH] Grammar --- src/mlpccg/database.ts | 7 +++++-- src/mlpccg/types.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mlpccg/database.ts b/src/mlpccg/database.ts index a9dd537..c4b9aae 100644 --- a/src/mlpccg/database.ts +++ b/src/mlpccg/database.ts @@ -1,10 +1,10 @@ import Dexie from "dexie"; -import { Card, CardFilter, StoredImages } from "./types"; +import { Card, CardFilter, StoredImage } from "./types"; import { cardFullName } from "./card"; class CardDatabase extends Dexie { public cards: Dexie.Table; - public images: Dexie.Table; + public images: Dexie.Table; public constructor() { super("CardDatabase"); @@ -155,6 +155,9 @@ export async function getCards(filter: CardFilter) { } export async function cardFromIDs(cardIDs: string[]): Promise { + if (Database == null) { + throw new Error("Database was not initialized, init with 'initDB()'"); + } let table = Database.cards; //TODO Replace with .bulkGet when upgrading to Dexie 3.x return await table diff --git a/src/mlpccg/types.ts b/src/mlpccg/types.ts index 7a8e6d3..85e1b4c 100644 --- a/src/mlpccg/types.ts +++ b/src/mlpccg/types.ts @@ -2,7 +2,7 @@ export type Rarity = "C" | "U" | "R" | "SR" | "UR" | "RR"; export type PowerRequirement = { [key: string]: number }; -export interface StoredImages { +export interface StoredImage { id: string; image: Blob; }