import { NextResponse } from 'next/server'; import { getCurrentUser } from '@/lib/server/auth'; import { listAllOrders } from '@/lib/server/store'; export const dynamic = 'force-dynamic'; export async function GET() { const user = await getCurrentUser(); if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); if (user.role !== 'admin') return NextResponse.json({ error: 'Forbidden' }, { status: 403 }); return NextResponse.json({ orders: await listAllOrders() }); }