ce805adb08
Add server-side EPUB import and integrate Prisma + Mongo for novels/chapters. Introduces a new moderator API route (app/api/mod/epub/route.ts) that parses .epub files, creates a novel record in Prisma, and inserts chapter documents into MongoDB via the Chapter Mongoose model. Frontend: novel management UI now supports EPUB upload (app/mod/truyen/novel-client.tsx) with progress/toasts and preserves the manual 'Add novel' dialog. Convert app pages to fetch real data from Prisma and Mongo (app/page.tsx, app/truyen/[slug]/page.tsx, app/truyen/[slug]/[chapterId]/page.tsx), adapt types/props to use authorName, and adjust chapter/comment IDs to use Mongo _id strings. Minor fixes: TTS player logs playback errors, UI text fixes (e.g. "Chương"), and novel-card/other components updated for authorName. package.json updated with epub2, html-to-text and types; pnpm lock updated. Adds tsconfig.tsbuildinfo.
63 lines
1.0 KiB
TypeScript
63 lines
1.0 KiB
TypeScript
export interface Genre {
|
|
id: string
|
|
name: string
|
|
slug: string
|
|
description: string
|
|
icon: string
|
|
}
|
|
|
|
export interface Novel {
|
|
id: string
|
|
title: string
|
|
slug: string
|
|
authorName: string
|
|
coverColor: string
|
|
description: string
|
|
genres: string[]
|
|
status: "Đang ra" | "Hoàn thành" | "Tạm ngưng"
|
|
totalChapters: number
|
|
views: number
|
|
rating: number
|
|
ratingCount: number
|
|
bookmarkCount: number
|
|
lastUpdated: string
|
|
createdAt: string
|
|
}
|
|
|
|
export interface Chapter {
|
|
id: string
|
|
novelId: string
|
|
number: number
|
|
title: string
|
|
content: string
|
|
views: number
|
|
createdAt: string
|
|
}
|
|
|
|
export interface User {
|
|
id: string
|
|
username: string
|
|
email: string
|
|
avatarColor: string
|
|
avatarUrl?: string
|
|
createdAt: string
|
|
}
|
|
|
|
export interface Comment {
|
|
id: string
|
|
userId: string
|
|
username: string
|
|
avatarColor: string
|
|
novelId: string
|
|
chapterId?: string
|
|
content: string
|
|
createdAt: string
|
|
}
|
|
|
|
export interface Bookmark {
|
|
novelId: string
|
|
lastChapterId?: string
|
|
lastChapterNumber?: number
|
|
addedAt: string
|
|
}
|