feat(admin): centralize subscriptions under /admin?tab=subscriptions
Replaced the dedicated /admin/subscriptions page with a redirect to the central admin panel’s subscriptions tab. Removed session checks, imports, and the AdminSubscriptionDashboard since routing and access are now handled centrally. This streamlines admin UX and keeps access control unified.
This commit is contained in:
1 parent
d8e7d5d7e6
commit
62ab5b2608
19 files changed
+3091
-357
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireAdminUser } from "@/lib/auth/middleware";
|
||||
import { generateItemStructure } from "@/lib/ai/generate-item-structure";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const auth = await requireAdminUser(request);
|
||||
if (auth instanceof NextResponse) {
|
||||
return auth;
|
||||
}
|
||||
|
||||
const body = await request.json();
|
||||
const name = typeof body?.name === "string" ? body.name.trim() : "";
|
||||
const description =
|
||||
typeof body?.description === "string" ? body.description.trim() : "";
|
||||
const scope = body?.scope === "server" ? "server" : "global";
|
||||
const server =
|
||||
scope === "server" && typeof body?.server === "string"
|
||||
? body.server.trim()
|
||||
: null;
|
||||
|
||||
if (!name || !description) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: "Informe nome e descrição para gerar o JSON estrutural.",
|
||||
},
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const result = await generateItemStructure({
|
||||
name,
|
||||
description,
|
||||
scope,
|
||||
server,
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
structure: result.structure,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user