Cockatrice/webclient/src/services/dexie/DexieDTOs/CardDTO.ts
Jeremy Letto 6ce346af4a
Webatrice: KnownHosts component (#4456)
* refactor dexie services for future schema updates

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
2021-11-25 22:12:23 -05:00

19 lines
420 B
TypeScript

import { Card } from 'types';
import { dexieService } from '../DexieService';
export class CardDTO extends Card {
save() {
return dexieService.cards.put(this);
}
static get(name) {
return dexieService.cards.where('name').equalsIgnoreCase(name).first();
}
static bulkAdd(cards: CardDTO[]): Promise<any> {
return dexieService.cards.bulkPut(cards);
}
};
dexieService.cards.mapToClass(CardDTO);