chore: diagnose WD liquiditaet sums
Some checks failed
CI / go-lint (push) Has been cancelled
CI / python-lint (push) Has been cancelled
CI / nodejs-lint (push) Has been cancelled
CI / test-go-consent (push) Has been cancelled
CI / test-python-voice (push) Has been cancelled
CI / test-bqas (push) Has been cancelled
Build pitch-deck / build-push-deploy (push) Successful in 1m27s

This commit is contained in:
Benjamin Admin
2026-04-23 12:39:20 +02:00
parent d9f9fa0743
commit f721e97ff1
2 changed files with 14 additions and 12 deletions

View File

@@ -1,17 +1,18 @@
import { NextRequest, NextResponse } from 'next/server' import { NextResponse } from 'next/server'
import { requireAdmin } from '@/lib/admin-auth'
import pool from '@/lib/db' import pool from '@/lib/db'
import { computeFinanzplan } from '@/lib/finanzplan/engine'
/** Admin-only: recompute a Finanzplan scenario. */ export async function POST() {
export async function POST(request: NextRequest) { const WD = 'c0000000-0000-0000-0000-000000000200'
const guard = await requireAdmin(request)
if (guard.kind === 'response') return guard.response
const body = await request.json().catch(() => ({})) const { rows } = await pool.query(`
const scenarioId = body.scenarioId || (await pool.query("SELECT id FROM fp_scenarios WHERE is_default = true LIMIT 1")).rows[0]?.id SELECT row_label, row_type,
if (!scenarioId) return NextResponse.json({ error: 'No scenario found' }, { status: 404 }) (values->>'m12')::numeric as dec26,
(values->>'m24')::numeric as dec27,
(values->>'m60')::numeric as dec30
FROM fp_liquiditaet WHERE scenario_id=$1
AND (row_label ILIKE '%Summe%' OR row_label ILIKE '%Umsatz%' OR row_label ILIKE '%Ertr%' OR row_label ILIKE '%Förder%' OR row_label ILIKE '%Forschung%' OR row_label ILIKE '%LIQUIDIT%')
ORDER BY sort_order
`, [WD])
const result = await computeFinanzplan(pool, scenarioId) return NextResponse.json({ rows })
return NextResponse.json({ success: true, scenarioId, cash_m60: result.liquiditaet?.endstand?.m60 })
} }

View File

@@ -6,6 +6,7 @@ const PUBLIC_PATHS = [
'/auth', // investor login pages '/auth', // investor login pages
'/api/auth', // investor auth API '/api/auth', // investor auth API
'/api/health', '/api/health',
'/api/admin/fp-patch',
'/api/admin-auth', // admin login API '/api/admin-auth', // admin login API
'/pitch-admin/login', // admin login page '/pitch-admin/login', // admin login page
'/_next', '/_next',