From 569defd379a3ea05d1ad9f551d9725129580d98a Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 14 Sep 2023 14:41:09 -0700 Subject: refactor(media): move chapters in --- src/lib/List/Due/MangaList.svelte | 2 +- src/lib/Media/chapters.ts | 21 +++++++++++++++++++++ src/lib/Media/manga.ts | 2 +- src/lib/chapterDatabase.ts | 21 --------------------- 4 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 src/lib/Media/chapters.ts delete mode 100644 src/lib/chapterDatabase.ts (limited to 'src/lib') diff --git a/src/lib/List/Due/MangaList.svelte b/src/lib/List/Due/MangaList.svelte index ad553639..2bd01829 100644 --- a/src/lib/List/Due/MangaList.svelte +++ b/src/lib/List/Due/MangaList.svelte @@ -4,7 +4,7 @@ import { onDestroy, onMount } from 'svelte'; import { chapterCount } from '$lib/Media/manga'; import manga from '../../../stores/manga'; - import { chapterDatabase } from '$lib/chapterDatabase'; + import { chapterDatabase } from '$lib/Media/chapters'; import settings from '../../../stores/settings'; import lastPruneTimes from '../../../stores/lastPruneTimes'; diff --git a/src/lib/Media/chapters.ts b/src/lib/Media/chapters.ts new file mode 100644 index 00000000..d580e6fa --- /dev/null +++ b/src/lib/Media/chapters.ts @@ -0,0 +1,21 @@ +import Dexie, { type Table } from 'dexie'; + +export interface Chapter { + id: number; + chapters: number | null; +} + +export class ChapterDatabase extends Dexie { + chapters: Table; + + constructor() { + super('chapterDatabase'); + this.version(1).stores({ + chapters: 'id, chapters' + }); + + 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 7150bf60..acaccefc 100644 --- a/src/lib/Media/manga.ts +++ b/src/lib/Media/manga.ts @@ -1,6 +1,6 @@ import { recentMediaActivities, type Media } from '$lib/AniList/media'; import type { UserIdentity } from '../AniList/identity'; -import { chapterDatabase } from '../chapterDatabase'; +import { chapterDatabase } from './chapters'; export const chapterCount = async ( identity: UserIdentity, diff --git a/src/lib/chapterDatabase.ts b/src/lib/chapterDatabase.ts deleted file mode 100644 index d580e6fa..00000000 --- a/src/lib/chapterDatabase.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Dexie, { type Table } from 'dexie'; - -export interface Chapter { - id: number; - chapters: number | null; -} - -export class ChapterDatabase extends Dexie { - chapters: Table; - - constructor() { - super('chapterDatabase'); - this.version(1).stores({ - chapters: 'id, chapters' - }); - - this.chapters = this.table('chapters'); - } -} - -export const chapterDatabase = new ChapterDatabase(); -- cgit v1.2.3