import { NextRequest, NextResponse } from 'next/server' import { requireAdmin } from '@/lib/admin-auth' import { createServiceClient } from '@/lib/supabase' export async function POST(req: NextRequest) { const check = await requireAdmin() if (check instanceof NextResponse) return check const { wert, label, reihenfolge } = await req.json() if (!wert || !label) return NextResponse.json({ error: 'Wert und Label erforderlich' }, { status: 400 }) const db = createServiceClient() const { data, error } = await db.from('ueber_uns_stats').insert({ wert, label, reihenfolge: reihenfolge ?? 99 }).select().single() if (error) return NextResponse.json({ error: error.message }, { status: 500 }) return NextResponse.json({ stat: data }, { status: 201 }) }