26 lines
727 B
TypeScript
26 lines
727 B
TypeScript
|
|
/**
|
||
|
|
* GET /api/analyzer/analyses/:id
|
||
|
|
*
|
||
|
|
* Fetch a specific analysis by id, including the full timeline / gaps /
|
||
|
|
* IT Glue references. Returns 404 if not found.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { NextResponse } from 'next/server';
|
||
|
|
import { requireAuth } from '@/lib/auth-utils';
|
||
|
|
import { getAnalysisById } from '@/lib/services/analyzer/persistence';
|
||
|
|
|
||
|
|
export async function GET(
|
||
|
|
_request: Request,
|
||
|
|
{ params }: { params: Promise<{ id: string }> }
|
||
|
|
) {
|
||
|
|
const { error } = await requireAuth();
|
||
|
|
if (error) return error;
|
||
|
|
|
||
|
|
const { id } = await params;
|
||
|
|
const analysis = await getAnalysisById(id);
|
||
|
|
if (!analysis) {
|
||
|
|
return NextResponse.json({ error: 'Analysis not found' }, { status: 404 });
|
||
|
|
}
|
||
|
|
return NextResponse.json({ analysis });
|
||
|
|
}
|