aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Database/IDB/user.ts
blob: e7285a077dfad1ee4c07549798d022cffd82c457 (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 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();