Services: Admin-Lehrer, Backend-Lehrer, Studio v2, Website, Klausur-Service, School-Service, Voice-Service, Geo-Service, BreakPilot Drive, Agent-Core Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* Consent Admin API Route - Deadlines Proxy
|
|
*/
|
|
|
|
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
const CONSENT_SERVICE_URL = process.env.CONSENT_SERVICE_URL || 'http://localhost:8081'
|
|
|
|
// Trigger deadline processing
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const authHeader = request.headers.get('Authorization')
|
|
|
|
const response = await fetch(`${CONSENT_SERVICE_URL}/api/v1/admin/deadlines/process`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
...(authHeader ? { 'Authorization': authHeader } : {})
|
|
},
|
|
signal: AbortSignal.timeout(30000)
|
|
})
|
|
|
|
if (!response.ok) {
|
|
const errorText = await response.text()
|
|
return NextResponse.json(
|
|
{ error: `Consent Service Error: ${response.status}`, details: errorText },
|
|
{ status: response.status }
|
|
)
|
|
}
|
|
|
|
const data = await response.json()
|
|
return NextResponse.json(data)
|
|
} catch (error) {
|
|
console.error('Deadlines process proxy error:', error)
|
|
return NextResponse.json(
|
|
{ error: 'Verbindung zum Consent Service fehlgeschlagen' },
|
|
{ status: 503 }
|
|
)
|
|
}
|
|
}
|