TTS-Arena-V2 / apps /web /src /app /api /admin /models /route.ts
GitHub Actions
Deploy from github.com/TTS-AGI/TTS-Arena@f49eded
374bcb6
Raw
History Blame Contribute Delete
566 Bytes
/** GET /api/admin/models — all models with ratings + vote counts. Admin only. */
import { NextResponse } from "next/server";
import type { AdminModelsResponse } from "@ttsa/shared";
import { requireAdmin } from "@/server/auth/admin";
import { listModels } from "@/server/admin/queries";
export async function GET() {
const guard = await requireAdmin();
if (!guard.ok) {
return NextResponse.json({ error: "forbidden" }, { status: guard.status });
}
const body: AdminModelsResponse = { models: await listModels() };
return NextResponse.json(body);
}