import { NextResponse } from 'next/server'; import { toApiErrorResponse } from '@/lib/auth'; import { listOwnerAudit } from '@/lib/owner-audit'; import { requireOwner } from '@/lib/owner-auth'; export async function GET(request: Request) { try { await requireOwner('VIEWER'); const { searchParams } = new URL(request.url); const limit = Math.min(Number(searchParams.get('limit') ?? 50), 100); const offset = Math.max(Number(searchParams.get('offset') ?? 0), 0); const entries = await listOwnerAudit(limit, offset); return NextResponse.json({ entries }); } catch (error) { return toApiErrorResponse(error); } }