feat: add reporting frontend, fix module categorization, update docs
- Create Reporting module frontend (page.tsx) with executive dashboard showing compliance score, risk overview, deadlines, module KPIs - Create Reporting lib (types.ts, api.ts) matching Go backend models - Add Reporting to STEP_EXPLANATIONS and both SDK sidebars - Remove DSB Portal, Multi-Tenant, SSO from SDK sidebars (admin-only) - Add Multi-Tenant, SSO, DSB Portal to dashboard navigation.ts with 'Plattform-Verwaltung' subgroup - Update docs: academy.md (PDF certs), reporting.md (new), index.md (SDK vs Admin categorization), mkdocs.yml (all modules) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
65
admin-compliance/lib/sdk/reporting/api.ts
Normal file
65
admin-compliance/lib/sdk/reporting/api.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Reporting API Client
|
||||
*
|
||||
* Client functions for the Executive Reporting module.
|
||||
* Communicates with the Go backend via Next.js API proxy at /api/sdk/v1/reporting/*
|
||||
*/
|
||||
|
||||
import type {
|
||||
ExecutiveReport,
|
||||
ComplianceScoreResponse,
|
||||
Deadline,
|
||||
RiskOverview,
|
||||
} from './types'
|
||||
|
||||
const BASE_URL = '/api/sdk/v1/reporting'
|
||||
|
||||
async function apiFetch<T>(path: string): Promise<T> {
|
||||
const res = await fetch(`${BASE_URL}${path}`, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Tenant-ID': typeof window !== 'undefined'
|
||||
? (localStorage.getItem('bp-tenant-id') || 'default')
|
||||
: 'default',
|
||||
},
|
||||
})
|
||||
|
||||
if (!res.ok) {
|
||||
const error = await res.json().catch(() => ({ error: res.statusText }))
|
||||
throw new Error(error.error || `API Error: ${res.status}`)
|
||||
}
|
||||
|
||||
return res.json()
|
||||
}
|
||||
|
||||
/**
|
||||
* Vollstaendigen Executive Report abrufen
|
||||
* GET /sdk/v1/reporting/executive
|
||||
*/
|
||||
export async function getExecutiveReport(): Promise<ExecutiveReport> {
|
||||
return apiFetch<ExecutiveReport>('/executive')
|
||||
}
|
||||
|
||||
/**
|
||||
* Nur den Compliance-Score abrufen (leichtgewichtig)
|
||||
* GET /sdk/v1/reporting/score
|
||||
*/
|
||||
export async function getComplianceScore(): Promise<ComplianceScoreResponse> {
|
||||
return apiFetch<ComplianceScoreResponse>('/score')
|
||||
}
|
||||
|
||||
/**
|
||||
* Bevorstehende Fristen abrufen
|
||||
* GET /sdk/v1/reporting/deadlines
|
||||
*/
|
||||
export async function getUpcomingDeadlines(): Promise<{ deadlines: Deadline[]; total: number }> {
|
||||
return apiFetch<{ deadlines: Deadline[]; total: number }>('/deadlines')
|
||||
}
|
||||
|
||||
/**
|
||||
* Risikouebersicht abrufen
|
||||
* GET /sdk/v1/reporting/risks
|
||||
*/
|
||||
export async function getRiskOverview(): Promise<RiskOverview> {
|
||||
return apiFetch<RiskOverview>('/risks')
|
||||
}
|
||||
Reference in New Issue
Block a user