Download src/app/api/admin/tools/route.ts from T2T-AI-X/copilot_work_3: direct link, hf CLI and curl.
- Browser
- Download file 703 Bytes
-
https://huggingface.co/T2T-AI-X/copilot_work_3/resolve/refs%2Fpr%2F4/src/app/api/admin/tools/route.ts
- Command line
-
hf download hf://T2T-AI-X/copilot_work_3@refs/pr/4/src/app/api/admin/tools/route.ts
-
curl -L -o route.ts https://huggingface.co/T2T-AI-X/copilot_work_3/resolve/refs%2Fpr%2F4/src/app/api/admin/tools/route.ts
703 Bytes
| import { NextResponse } from "next/server"; | |
| import { adminDenied, checkAdmin } from "@/lib/admin-auth"; | |
| import { toolStatuses } from "@/lib/tool-types"; | |
| import type { ToolStatus } from "@/lib/tool-types"; | |
| import { listToolsByStatus } from "@/lib/tools"; | |
| export async function GET(request: Request) { | |
| const auth = checkAdmin(request); | |
| if (auth !== "ok") return adminDenied(auth); | |
| const status = new URL(request.url).searchParams.get("status") ?? "pending"; | |
| if (!toolStatuses.includes(status as ToolStatus)) { | |
| return NextResponse.json({ error: "Unknown status." }, { status: 400 }); | |
| } | |
| const tools = await listToolsByStatus(status as ToolStatus); | |
| return NextResponse.json({ tools }); | |
| } | |