feat(pitch-deck): change preferred_lang for existing investors from detail page
Build pitch-deck / build-push-deploy (push) Successful in 1m27s
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 33s
CI / test-python-voice (push) Successful in 33s
CI / test-bqas (push) Successful in 34s

- GET /api/admin/investors/:id now returns preferred_lang
- PATCH /api/admin/investors/:id accepts preferred_lang (de/en), validates value
- Investor detail page: DE/EN toggle in the Pitch Version card, instant save on click

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-05-06 23:31:59 +02:00
parent b0d273d3ab
commit ec7eee8e3d
2 changed files with 43 additions and 8 deletions
@@ -19,7 +19,7 @@ export async function GET(request: NextRequest, ctx: RouteContext) {
pool.query(
`SELECT i.id, i.email, i.name, i.company, i.status, i.last_login_at, i.login_count,
i.created_at, i.updated_at, i.first_activity_at, i.data_masked_at,
i.assigned_version_id, i.is_showcase,
i.assigned_version_id, i.is_showcase, i.preferred_lang,
v.name AS version_name, v.status AS version_status
FROM pitch_investors i
LEFT JOIN pitch_versions v ON v.id = i.assigned_version_id
@@ -68,14 +68,14 @@ export async function PATCH(request: NextRequest, ctx: RouteContext) {
const { id } = await ctx.params
const body = await request.json().catch(() => ({}))
const { name, company, assigned_version_id, is_showcase } = body
const { name, company, assigned_version_id, is_showcase, preferred_lang } = body
if (name === undefined && company === undefined && assigned_version_id === undefined && is_showcase === undefined) {
return NextResponse.json({ error: 'name, company, assigned_version_id, or is_showcase required' }, { status: 400 })
if (name === undefined && company === undefined && assigned_version_id === undefined && is_showcase === undefined && preferred_lang === undefined) {
return NextResponse.json({ error: 'name, company, assigned_version_id, is_showcase, or preferred_lang required' }, { status: 400 })
}
const before = await pool.query(
`SELECT name, company, assigned_version_id, is_showcase FROM pitch_investors WHERE id = $1`,
`SELECT name, company, assigned_version_id, is_showcase, preferred_lang FROM pitch_investors WHERE id = $1`,
[id],
)
if (before.rows.length === 0) {
@@ -98,8 +98,8 @@ export async function PATCH(request: NextRequest, ctx: RouteContext) {
// Use null to clear version assignment, undefined to leave unchanged
const versionValue = assigned_version_id === undefined ? before.rows[0].assigned_version_id : (assigned_version_id || null)
const showcaseValue = is_showcase !== undefined ? Boolean(is_showcase) : before.rows[0].is_showcase
const langValue = preferred_lang === 'en' || preferred_lang === 'de' ? preferred_lang : before.rows[0].preferred_lang
const { rows } = await pool.query(
`UPDATE pitch_investors SET
@@ -107,10 +107,11 @@ export async function PATCH(request: NextRequest, ctx: RouteContext) {
company = COALESCE($2, company),
assigned_version_id = $4,
is_showcase = $5,
preferred_lang = $6,
updated_at = NOW()
WHERE id = $3
RETURNING id, email, name, company, status, assigned_version_id, is_showcase`,
[name ?? null, company ?? null, id, versionValue, showcaseValue],
RETURNING id, email, name, company, status, assigned_version_id, is_showcase, preferred_lang`,
[name ?? null, company ?? null, id, versionValue, showcaseValue, langValue],
)
const action = assigned_version_id !== undefined && assigned_version_id !== before.rows[0].assigned_version_id