import { NextRequest, NextResponse } from 'next/server' import prisma from '../../../../../lib/prisma' import { isAdmin } from '@/lib/auth-utils' // PATCH /api/admin/reports/[id] — Update report status export async function PATCH( request: NextRequest, context: { params: Promise<{ id: string }> } ): Promise { try { const { id } = await context.params const { status } = await request.json() if (!(await isAdmin(request))) { return NextResponse.json({ error: 'Accès réservé aux administrateurs' }, { status: 403 }) } const report = await prisma.messageReport.update({ where: { id }, data: { status } }) return NextResponse.json(report) } catch (error) { console.error('PATCH /api/admin/reports/[id] error:', error) return NextResponse.json({ error: 'Erreur serveur' }, { status: 500 }) } }