aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Database/IndexedDB/user.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-07-25 00:19:44 -0700
committerFuwn <[email protected]>2024-07-25 00:20:23 -0700
commit2d9235070856c0a5032ddf47f7b1dc7cc5cceb60 (patch)
tree4677f0355872a0f7f55d38a372ec5e3870771182 /src/lib/Database/IndexedDB/user.ts
parentfeat(notifications): allow unsubscribe (diff)
downloaddue.moe-2d9235070856c0a5032ddf47f7b1dc7cc5cceb60.tar.xz
due.moe-2d9235070856c0a5032ddf47f7b1dc7cc5cceb60.zip
refactor(Database): separate providers
Diffstat (limited to 'src/lib/Database/IndexedDB/user.ts')
-rw-r--r--src/lib/Database/IndexedDB/user.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/Database/IndexedDB/user.ts b/src/lib/Database/IndexedDB/user.ts
new file mode 100644
index 00000000..e7285a07
--- /dev/null
+++ b/src/lib/Database/IndexedDB/user.ts
@@ -0,0 +1,23 @@
+import type { AniListAuthorisation } from '$lib/Data/AniList/identity';
+import Dexie, { type Table } from 'dexie';
+
+export interface User {
+ id: number;
+ user: AniListAuthorisation;
+ lastNotificationID: number | null;
+}
+
+export class UserDatabase extends Dexie {
+ users: Table<User>;
+
+ constructor() {
+ super('users');
+ this.version(1).stores({
+ users: 'id, user, lastNotificationID'
+ });
+
+ this.users = this.table('users');
+ }
+}
+
+export const database = new UserDatabase();