18 lines
577 B
TypeScript
18 lines
577 B
TypeScript
|
|
import { IStore } from '../../storage/IStore';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* CustomerStore - IndexedDB ObjectStore definition for customers
|
||
|
|
*/
|
||
|
|
export class CustomerStore implements IStore {
|
||
|
|
static readonly STORE_NAME = 'customers';
|
||
|
|
readonly storeName = CustomerStore.STORE_NAME;
|
||
|
|
|
||
|
|
create(db: IDBDatabase): void {
|
||
|
|
const store = db.createObjectStore(CustomerStore.STORE_NAME, { keyPath: 'id' });
|
||
|
|
|
||
|
|
store.createIndex('name', 'name', { unique: false });
|
||
|
|
store.createIndex('phone', 'phone', { unique: false });
|
||
|
|
store.createIndex('syncStatus', 'syncStatus', { unique: false });
|
||
|
|
}
|
||
|
|
}
|