3332eb0bf9
Snapshot-getriebene Result-Views, entkoppelt vom Live-Check:
- CookieResultView: laedt cmp_vendors aus einem Snapshot (kein Re-Crawl),
KPIs (Anbieter/Cookies/Marketing/Drittland) + Empfaenger-Gruppen
(Eigene/AVV/Joint-Controller) + aufklappbare Vendor->Cookie-Tabelle.
- Historie (/sdk/agent/snapshots): alle gespeicherten Checks, jederzeit
oeffnbar (DSB/Mitarbeiter) + Detail-Seite je Snapshot.
- Next.js-Proxys fuer GET /snapshots (Liste) + /snapshots/{id} (einzeln).
BMW-Snapshot 4603d15b: 83 Vendors / 780 Cookies. Library-Abgleich
(cookie_knowledge_db.lookup_cookie) folgt als Phase B.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
/**
|
|
* Snapshot-Liste (Historie)
|
|
* GET /api/sdk/v1/agent/snapshots?domain=&limit=
|
|
* → backend /api/compliance/agent/snapshots
|
|
*
|
|
* Ohne domain: alle letzten Snapshots (Historie zum Durchklicken).
|
|
*/
|
|
|
|
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
const BACKEND_URL =
|
|
process.env.BACKEND_API_URL || process.env.BACKEND_URL ||
|
|
'http://backend-compliance:8002'
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const { searchParams } = new URL(request.url)
|
|
const domain = searchParams.get('domain') || ''
|
|
const limit = searchParams.get('limit') || '50'
|
|
try {
|
|
const response = await fetch(
|
|
`${BACKEND_URL}/api/compliance/agent/snapshots`
|
|
+ `?domain=${encodeURIComponent(domain)}&limit=${encodeURIComponent(limit)}`,
|
|
{ signal: AbortSignal.timeout(30_000) },
|
|
)
|
|
const data = await response.json()
|
|
return NextResponse.json(data, { status: response.status })
|
|
} catch {
|
|
return NextResponse.json(
|
|
{ error: 'Snapshot-Liste zum Backend fehlgeschlagen', snapshots: [] },
|
|
{ status: 503 },
|
|
)
|
|
}
|
|
}
|