From 439bfdbfb54714feaaf37bb00377c6fb1f9bc12b Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 17 Dec 2023 04:39:54 -0800 Subject: refactor(manga): move database --- src/lib/Media/Manga/database.ts | 22 ++++++++++++++++++++++ src/lib/Media/chapters.ts | 22 ---------------------- src/lib/Media/manga.ts | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 src/lib/Media/Manga/database.ts delete mode 100644 src/lib/Media/chapters.ts (limited to 'src/lib/Media') diff --git a/src/lib/Media/Manga/database.ts b/src/lib/Media/Manga/database.ts new file mode 100644 index 00000000..a8a4d716 --- /dev/null +++ b/src/lib/Media/Manga/database.ts @@ -0,0 +1,22 @@ +import Dexie, { type Table } from 'dexie'; + +export interface Chapter { + id: number; + chapters: number | null; + volumes: number | null; +} + +export class ChapterDatabase extends Dexie { + chapters: Table; + + constructor() { + super('chapterDatabase'); + this.version(1).stores({ + chapters: 'id, chapters, volumes' + }); + + this.chapters = this.table('chapters'); + } +} + +export const chapterDatabase = new ChapterDatabase(); diff --git a/src/lib/Media/chapters.ts b/src/lib/Media/chapters.ts deleted file mode 100644 index a8a4d716..00000000 --- a/src/lib/Media/chapters.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Dexie, { type Table } from 'dexie'; - -export interface Chapter { - id: number; - chapters: number | null; - volumes: number | null; -} - -export class ChapterDatabase extends Dexie { - chapters: Table; - - constructor() { - super('chapterDatabase'); - this.version(1).stores({ - chapters: 'id, chapters, volumes' - }); - - this.chapters = this.table('chapters'); - } -} - -export const chapterDatabase = new ChapterDatabase(); diff --git a/src/lib/Media/manga.ts b/src/lib/Media/manga.ts index 8842d9d9..a79445ae 100644 --- a/src/lib/Media/manga.ts +++ b/src/lib/Media/manga.ts @@ -2,7 +2,7 @@ import { recentMediaActivities, type Media } from '$lib/AniList/media'; import manga from '../../stores/manga'; import settings from '../../stores/settings'; import type { UserIdentity } from '../AniList/identity'; -import { chapterDatabase } from './chapters'; +import { chapterDatabase } from './Manga/database'; export const pruneAllManga = async () => { const all = await chapterDatabase.chapters.toArray(); -- cgit v1.2.3