From d56db023bed8eeff543ec150c5ce302c2d21a532 Mon Sep 17 00:00:00 2001 From: lorentz Date: Sat, 11 Jul 2026 15:16:38 -0400 Subject: [PATCH] fix(14): cast companies-list id to Number to match resolve route's z.number() schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit companies.id is BIGINT and node-postgres serializes it as a string. The manual-search fallback (D-05) fetches from this route and sends the id straight through to POST /company-matches/[id]/resolve, whose Zod schema requires a JS number with no coercion — every manual-search resolution was rejected with 400. Every other PAX8 route in this phase already casts bigint columns via Number(); this route was the one omission. Found by code review (14-REVIEW.md, CR-01). --- app/api/data/companies-list/route.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/data/companies-list/route.ts b/app/api/data/companies-list/route.ts index 33dc84e..e29d3fc 100644 --- a/app/api/data/companies-list/route.ts +++ b/app/api/data/companies-list/route.ts @@ -10,7 +10,11 @@ export async function GET() { const result = await postgresClient.query( `SELECT id, company_name FROM companies WHERE is_active = true AND is_deleted = false ORDER BY company_name ASC` ); - return NextResponse.json(result.rows); + const companies = result.rows.map((row) => ({ + id: Number(row.id), + company_name: row.company_name, + })); + return NextResponse.json(companies); } catch (error) { console.error('Error fetching companies list:', error); return NextResponse.json({ error: 'Failed to fetch companies list' }, { status: 500 });