I am done for the night...
This commit is contained in:
35
src/lib/db_events.ts
Normal file
35
src/lib/db_events.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import Dexie, { type Table } from 'dexie';
|
||||
|
||||
export interface Badge {
|
||||
// id?: number;
|
||||
id_random: string;
|
||||
full_name: string;
|
||||
full_name_override: null|string;
|
||||
email: string;
|
||||
email_override: null|string;
|
||||
affiliations: string;
|
||||
affiliations_override: null|string;
|
||||
badge_type: string;
|
||||
badge_type_code: string;
|
||||
badge_type_code_override: null|string;
|
||||
badge_type_override: null|string;
|
||||
external_event_id: string;
|
||||
external_id: string;
|
||||
external_person_id: string;
|
||||
}
|
||||
|
||||
export class MySubClassedDexie extends Dexie {
|
||||
// 'badges' is added by dexie when declaring the stores()
|
||||
// We just tell the typing system this is the case
|
||||
badges!: Table<Badge>;
|
||||
|
||||
constructor() {
|
||||
super('ae_events_db');
|
||||
this.version(1).stores({
|
||||
// badges: '++id, full_name, email' // Primary key and indexed props
|
||||
badges: 'id_random, full_name, full_name_override, email, email_override, affiliations, affiliations_override, badge_type, badge_type_code, badge_type_code_override, badge_type_override, external_event_id, external_id, external_person_id' // Primary key and indexed props
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const db_events = new MySubClassedDexie();
|
||||
Reference in New Issue
Block a user