import { auth } from '@/lib/auth' import { NextResponse } from 'next/server' export async function requireAdmin() { const session = await auth() if (!session || (session.user as { role?: string }).role !== 'ADMIN') { throw new Error('Unauthorized') } return session } export function unauthorized() { return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) }