feat(agent): Cookie-Result-View + Check-Historie aus Snapshots
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>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Snapshot-Proxy
|
||||
* GET /api/sdk/v1/agent/snapshots/{snapshotId}
|
||||
* → backend /api/compliance/agent/snapshots/{snapshotId}
|
||||
*
|
||||
* Liefert die persistierten Roh-Daten eines Checks (cmp_vendors + Cookies +
|
||||
* banner_result) — Basis für den Cookie-Result-View OHNE Re-Crawl.
|
||||
*/
|
||||
|
||||
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,
|
||||
{ params }: { params: Promise<{ snapshotId: string }> },
|
||||
) {
|
||||
const { snapshotId } = await params
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${BACKEND_URL}/api/compliance/agent/snapshots/${snapshotId}`,
|
||||
{ signal: AbortSignal.timeout(60_000) },
|
||||
)
|
||||
const data = await response.json()
|
||||
return NextResponse.json(data, { status: response.status })
|
||||
} catch {
|
||||
return NextResponse.json(
|
||||
{ error: 'Snapshot-Laden zum Backend fehlgeschlagen' },
|
||||
{ status: 503 },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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 },
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user