Add moderation APIs and admin UI

Add moderator/admin backend APIs and client features for managing novels and chapters. New endpoints include mod chapter routes (paginated list, single GET, PUT, DELETE, and bulk optimize), mod novel routes (create, GET by id, update, delete), genre CRUD, user bookmarks, novel comments, and rating endpoints. Update EPUB import to use a shared slugify util. Enhance moderator UI: chapter manager gains pagination, bulk optimization preview/apply, edit/delete dialogs; novel client adds genre management and edit/delete flows. Also update Prisma schema, add a DB wipe script, remove unused lib/data.ts, and adjust related types/utils and bookmark context.
This commit is contained in:
2026-03-06 17:30:56 +07:00
parent ce805adb08
commit 75ed8e233b
31 changed files with 1853 additions and 687 deletions
+5 -7
View File
@@ -5,7 +5,7 @@ import { BookOpen, BookMarked, Trash2 } from "lucide-react"
import { Button } from "@/components/ui/button"
import { useAuth } from "@/lib/auth-context"
import { useBookmarks } from "@/lib/bookmark-context"
import { getNovelById } from "@/lib/data"
export default function BookshelfPage() {
const { user } = useAuth()
@@ -24,12 +24,10 @@ export default function BookshelfPage() {
)
}
const bookmarkedNovels = bookmarks
.map((b) => {
const novel = getNovelById(b.novelId)
return novel ? { novel, bookmark: b } : null
})
.filter(Boolean) as Array<{ novel: NonNullable<ReturnType<typeof getNovelById>>; bookmark: typeof bookmarks[number] }>
const bookmarkedNovels = bookmarks.filter(b => b.novel).map(b => ({
novel: b.novel as any,
bookmark: b
}))
return (
<div className="mx-auto max-w-6xl px-4 py-6">