26 lines
851 B
TypeScript
26 lines
851 B
TypeScript
|
|
/**
|
||
|
|
* GET /api/analyzer/needs-review
|
||
|
|
*
|
||
|
|
* Returns the queue of completed analyses where needs_human_review = true.
|
||
|
|
* Optional query params: limit (default 50, max 200), offset (default 0).
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { NextRequest, NextResponse } from 'next/server';
|
||
|
|
import { requireAuth } from '@/lib/auth-utils';
|
||
|
|
import { listNeedsReview } from '@/lib/services/analyzer/persistence';
|
||
|
|
|
||
|
|
export async function GET(request: NextRequest) {
|
||
|
|
const { error } = await requireAuth();
|
||
|
|
if (error) return error;
|
||
|
|
|
||
|
|
const params = request.nextUrl.searchParams;
|
||
|
|
const limit = parseInt(params.get('limit') ?? '50', 10);
|
||
|
|
const offset = parseInt(params.get('offset') ?? '0', 10);
|
||
|
|
|
||
|
|
const analyses = await listNeedsReview({
|
||
|
|
limit: Number.isFinite(limit) ? limit : 50,
|
||
|
|
offset: Number.isFinite(offset) ? offset : 0,
|
||
|
|
});
|
||
|
|
return NextResponse.json({ analyses });
|
||
|
|
}
|