import { NextRequest, NextResponse } from 'next/server' import { requireAdmin } from '@/lib/admin-auth' import { createServiceClient } from '@/lib/supabase' export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const check = await requireAdmin() if (check instanceof NextResponse) return check const { id } = await params const body = await req.json() const db = createServiceClient() const { error } = await db.from('kontakt_oeffnungszeiten').update(body).eq('id', id) if (error) return NextResponse.json({ error: error.message }, { status: 500 }) return NextResponse.json({ success: true }) } export async function DELETE(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const check = await requireAdmin() if (check instanceof NextResponse) return check const { id } = await params const db = createServiceClient() const { error } = await db.from('kontakt_oeffnungszeiten').delete().eq('id', id) if (error) return NextResponse.json({ error: error.message }, { status: 500 }) return NextResponse.json({ success: true }) }