fix: rename 2. Finanzierungsrunde (optional)
All checks were successful
Build pitch-deck / build-push-deploy (push) Successful in 1m8s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 32s
CI / test-python-voice (push) Successful in 31s
CI / test-bqas (push) Successful in 29s
All checks were successful
Build pitch-deck / build-push-deploy (push) Successful in 1m8s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-consent (push) Successful in 32s
CI / test-python-voice (push) Successful in 31s
CI / test-bqas (push) Successful in 29s
This commit is contained in:
@@ -1,36 +1,8 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import pool from '@/lib/db'
|
||||
import { computeFinanzplan } from '@/lib/finanzplan/engine'
|
||||
|
||||
export async function POST() {
|
||||
const WD = 'c0000000-0000-0000-0000-000000000200'
|
||||
const results: string[] = []
|
||||
|
||||
try {
|
||||
// Recompute WD
|
||||
const r1 = await computeFinanzplan(pool, WD)
|
||||
results.push(`WD cash_m60=${r1.liquiditaet?.endstand?.m60}`)
|
||||
|
||||
// Check GuV values
|
||||
const { rows: guv } = await pool.query(
|
||||
`SELECT row_label, (values->>'y2026')::numeric as y26, (values->>'y2027')::numeric as y27, (values->>'y2030')::numeric as y30
|
||||
FROM fp_guv WHERE scenario_id=$1 AND row_label IN ('Umsatzerlöse','EBIT','Rohergebnis','Jahresüberschuss') ORDER BY sort_order`, [WD])
|
||||
results.push(`GuV: ${JSON.stringify(guv)}`)
|
||||
|
||||
// Check Liquidität
|
||||
const { rows: liq } = await pool.query(
|
||||
`SELECT row_label, (values->>'m12')::numeric as m12, (values->>'m60')::numeric as m60
|
||||
FROM fp_liquiditaet WHERE scenario_id=$1 AND row_label='LIQUIDITÄT'`, [WD])
|
||||
results.push(`Liq: ${JSON.stringify(liq)}`)
|
||||
|
||||
// Check Bestandskunden gesamt
|
||||
const { rows: kd } = await pool.query(
|
||||
`SELECT row_label, (values->>'m12')::numeric as m12, (values->>'m60')::numeric as m60
|
||||
FROM fp_kunden WHERE scenario_id=$1 AND row_label='Bestandskunden gesamt'`, [WD])
|
||||
results.push(`Kunden: ${JSON.stringify(kd)}`)
|
||||
} catch (err) {
|
||||
results.push(`ERROR: ${err instanceof Error ? err.message : String(err)}`)
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true, results })
|
||||
await pool.query(`UPDATE fp_liquiditaet SET row_label='2. Finanzierungsrunde (optional)' WHERE scenario_id=$1 AND row_label='2. Finanzierungsrunde'`, [WD])
|
||||
return NextResponse.json({ ok: true })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user