aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Database/IDB/user.ts
blob: 23e274d4a49bdc12e36bda0540e8b5728879f2f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Dexie, { type Table } from "dexie";
import type { AniListAuthorisation } from "$lib/Data/AniList/identity";

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();