feat(pitch-deck): show version name + status in preview banner

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-13 12:21:59 +02:00
parent b6d3fad6ab
commit c02a7bd8a6
2 changed files with 22 additions and 5 deletions

View File

@@ -13,6 +13,15 @@ export async function GET(request: NextRequest, ctx: Ctx) {
const { versionId } = await ctx.params
// Load version metadata
const ver = await pool.query(
`SELECT name, status FROM pitch_versions WHERE id = $1`,
[versionId],
)
if (ver.rows.length === 0) {
return NextResponse.json({ error: 'Version not found' }, { status: 404 })
}
// Load version data
const { rows } = await pool.query(
`SELECT table_name, data FROM pitch_version_data WHERE version_id = $1`,
@@ -20,7 +29,7 @@ export async function GET(request: NextRequest, ctx: Ctx) {
)
if (rows.length === 0) {
return NextResponse.json({ error: 'Version not found or has no data' }, { status: 404 })
return NextResponse.json({ error: 'Version has no data' }, { status: 404 })
}
const map: Record<string, unknown[]> = {}
@@ -28,7 +37,7 @@ export async function GET(request: NextRequest, ctx: Ctx) {
map[row.table_name] = typeof row.data === 'string' ? JSON.parse(row.data) : row.data
}
// Return PitchData format
// Return PitchData format + version metadata
return NextResponse.json({
company: (map.company || [])[0] || null,
team: map.team || [],
@@ -40,5 +49,6 @@ export async function GET(request: NextRequest, ctx: Ctx) {
metrics: map.metrics || [],
funding: (map.funding || [])[0] || null,
products: map.products || [],
_version: { name: ver.rows[0].name, status: ver.rows[0].status },
})
}