v0.11.1: 权限体系重构 + AI管线优化 + 内容整理

This commit is contained in:
sgp
2026-05-22 18:36:41 +08:00
parent 7955d11c52
commit b33fe1e8e1
397 changed files with 30940 additions and 161 deletions
@@ -0,0 +1,35 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
import { requireAdmin } from "@/lib/admin-auth";
export async function DELETE(
request: Request,
{ params }: { params: { id: string } }
) {
const authError = await requireAdmin();
if (authError) return authError;
try {
const id = parseInt(params.id);
const body = await request.json();
const { type } = body as { type: "published" | "pending" };
if (!type || !["published", "pending"].includes(type)) {
return NextResponse.json(
{ error: "type 参数无效,必须为 published 或 pending" },
{ status: 400 }
);
}
if (type === "published") {
await prisma.tool.delete({ where: { id } });
} else {
await prisma.pendingTool.delete({ where: { id } });
}
return NextResponse.json({ success: true });
} catch (error: unknown) {
const err = error as { message?: string };
return NextResponse.json({ error: err.message }, { status: 500 });
}
}