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:
@@ -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 },
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user