mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
* new login design * remove effects file (wrong direction) * add Known Hosts dropdown component Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
28 lines
654 B
TypeScript
28 lines
654 B
TypeScript
import { IndexableType } from 'dexie';
|
|
import { Host } from 'types';
|
|
|
|
import { dexieService } from '../DexieService';
|
|
|
|
export class HostDTO extends Host {
|
|
save() {
|
|
return dexieService.hosts.put(this);
|
|
}
|
|
|
|
static add(host: HostDTO): Promise<IndexableType> {
|
|
return dexieService.hosts.add(host);
|
|
}
|
|
|
|
static get(id): Promise<HostDTO> {
|
|
return dexieService.hosts.where('id').equals(id).first();
|
|
}
|
|
|
|
static getAll(): Promise<HostDTO[]> {
|
|
return dexieService.hosts.toArray();
|
|
}
|
|
|
|
static bulkAdd(hosts: Host[]): Promise<IndexableType> {
|
|
return dexieService.hosts.bulkAdd(hosts);
|
|
}
|
|
};
|
|
|
|
dexieService.hosts.mapToClass(HostDTO);
|