refactor: remove catalog sync jobs and version history
This commit is contained in:
@@ -16,9 +16,9 @@ import { builtInTemplates } from "@/lib/templates";
|
||||
import { persistTemplateApplication } from "@/lib/templates/persist";
|
||||
import {
|
||||
createGuide,
|
||||
enqueueCatalogSync,
|
||||
permanentlyDeleteGuide,
|
||||
restoreGuide,
|
||||
runCatalogSync,
|
||||
saveArtifacts,
|
||||
saveConstellations,
|
||||
saveExtraSections,
|
||||
@@ -274,10 +274,9 @@ export async function deleteStructuredGuide(guideId: string) {
|
||||
}
|
||||
|
||||
export async function startCatalogSync() {
|
||||
const admin = await requireAdmin();
|
||||
await requireAdmin();
|
||||
try {
|
||||
const job = await enqueueCatalogSync(admin.user.id);
|
||||
return { status: "saved" as const, jobId: job.id };
|
||||
return await runCatalogSync();
|
||||
} catch (cause) {
|
||||
return { status: "error" as const, message: cause instanceof Error ? cause.message : "เริ่ม Sync ไม่สำเร็จ" };
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async function CreateGuidePage() {
|
||||
<main className="mx-auto flex w-full max-w-7xl flex-col gap-8 p-4 sm:p-6 lg:p-8">
|
||||
<header className="flex items-center gap-4">
|
||||
<Button variant="outline" size="icon" render={<Link href="/admin" />} nativeButton={false} aria-label="กลับ Dashboard"><ArrowLeftIcon /></Button>
|
||||
<div><p className="text-sm text-muted-foreground">Catalog {catalog.version}</p><h1 className="font-heading text-3xl font-semibold">สร้าง Guide ใหม่</h1></div>
|
||||
<div><p className="text-sm text-muted-foreground">Catalog ล่าสุดจาก Lunaris</p><h1 className="font-heading text-3xl font-semibold">สร้าง Guide ใหม่</h1></div>
|
||||
</header>
|
||||
<CreateGuideFlow characters={catalog.characters} existingKeys={guides.map((guide) => guide.characterKey)} />
|
||||
</main>
|
||||
|
||||
+3
-4
@@ -4,15 +4,14 @@ import { connection } from "next/server";
|
||||
import { StructuredDashboard } from "@/components/admin/structured-dashboard";
|
||||
import { AdminHeader } from "@/components/admin/admin-header";
|
||||
import { getAdminSession } from "@/lib/auth/server";
|
||||
import { getActiveCatalog, getLatestCatalogSyncJob, listGuideCards } from "@/lib/guides/queries";
|
||||
import { getActiveCatalog, listGuideCards } from "@/lib/guides/queries";
|
||||
|
||||
export default async function AdminPage() {
|
||||
await connection();
|
||||
if (!(await getAdminSession())) redirect("/admin/login");
|
||||
const [guides, trash, syncJob, catalog] = await Promise.all([
|
||||
const [guides, trash, catalog] = await Promise.all([
|
||||
listGuideCards(),
|
||||
listGuideCards(true),
|
||||
getLatestCatalogSyncJob(),
|
||||
getActiveCatalog(),
|
||||
]);
|
||||
return (
|
||||
@@ -24,7 +23,7 @@ export default async function AdminPage() {
|
||||
<h1 className="font-heading text-3xl font-semibold">Guide Dashboard</h1>
|
||||
<p className="mt-2 text-muted-foreground">จัดการ Guide แบบภาพ-first และบันทึกขึ้นเว็บไซต์ทันที</p>
|
||||
</header>
|
||||
<StructuredDashboard guides={guides} trash={trash} syncJob={syncJob} catalogVersion={catalog?.version ?? null} />
|
||||
<StructuredDashboard guides={guides} trash={trash} catalogReady={Boolean(catalog)} />
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user