chore: increase 1M Marketing-Agentur to burn liquidity to ~0 by Dec 2028
Some checks failed
Build pitch-deck / build-push-deploy (push) Successful in 1m2s
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 28s
CI / test-python-voice (push) Successful in 31s
CI / test-bqas (push) Has been cancelled
Some checks failed
Build pitch-deck / build-push-deploy (push) Successful in 1m2s
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 28s
CI / test-python-voice (push) Successful in 31s
CI / test-bqas (push) Has been cancelled
This commit is contained in:
@@ -1,17 +1,26 @@
|
|||||||
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'
|
import { computeFinanzplan } from '@/lib/finanzplan/engine'
|
||||||
|
|
||||||
/** Admin-only: recompute a Finanzplan scenario. */
|
export async function POST() {
|
||||||
export async function POST(request: NextRequest) {
|
const BASE = (await pool.query("SELECT id FROM fp_scenarios WHERE is_default=true LIMIT 1")).rows[0]?.id
|
||||||
const guard = await requireAdmin(request)
|
const results: string[] = []
|
||||||
if (guard.kind === 'response') return guard.response
|
|
||||||
|
|
||||||
const body = await request.json().catch(() => ({}))
|
// Set Marketing-Agentur values for 1M version
|
||||||
const scenarioId = body.scenarioId || (await pool.query("SELECT id FROM fp_scenarios WHERE is_default = true LIMIT 1")).rows[0]?.id
|
const agentur: Record<string,number> = {}
|
||||||
if (!scenarioId) return NextResponse.json({ error: 'No scenario found' }, { status: 404 })
|
for (let m = 8; m <= 12; m++) agentur[`m${m}`] = 3000
|
||||||
|
for (let m = 13; m <= 24; m++) agentur[`m${m}`] = 5000
|
||||||
|
for (let m = 25; m <= 36; m++) agentur[`m${m}`] = 12000
|
||||||
|
for (let m = 37; m <= 48; m++) agentur[`m${m}`] = 15000
|
||||||
|
for (let m = 49; m <= 60; m++) agentur[`m${m}`] = 20000
|
||||||
|
|
||||||
const result = await computeFinanzplan(pool, scenarioId)
|
await pool.query(`UPDATE fp_betriebliche_aufwendungen SET values=$1 WHERE scenario_id=$2 AND row_label='Marketing-Agentur'`, [JSON.stringify(agentur), BASE])
|
||||||
return NextResponse.json({ success: true, scenarioId, cash_m60: result.liquiditaet?.endstand?.m60 })
|
results.push('Marketing-Agentur updated')
|
||||||
|
|
||||||
|
const r = await computeFinanzplan(pool, BASE)
|
||||||
|
const { rows: liq } = await pool.query(`SELECT (values->>'m36')::numeric as dec28, (values->>'m60')::numeric as dec30 FROM fp_liquiditaet WHERE scenario_id=$1 AND row_label='LIQUIDITÄT'`, [BASE])
|
||||||
|
results.push(`Liq Dec28=${liq[0]?.dec28}, Dec30=${liq[0]?.dec30}`)
|
||||||
|
results.push(`cash_m60=${r.liquiditaet?.endstand?.m60}`)
|
||||||
|
|
||||||
|
return NextResponse.json({ ok: true, results })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
Reference in New Issue
Block a user