From 42b4b2812bdddf8d89d8a4c95ea2acc28d1b00b3 Mon Sep 17 00:00:00 2001 From: Ysterbaard Date: Wed, 19 Aug 2026 10:20:11 +0200 Subject: [PATCH] Fix structured-address + onboarding fields not persisting from edit modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /api/pb/records/[id] proxy had an allowlist of editable fields that was written before the 2026-08-18 onboarding field additions. The new fields were silently dropped before reaching PocketBase, so the modal appeared to save successfully but the data never landed in PB. Added to COMPANY_EDIT_FIELDS: physical_address_line_1/2, physical_town_city, physical_province, physical_postal_code, postal_address_line_1/2, postal_town_city, postal_province, postal_postal_code, company_email, company_cell_phone, public_officer_name, company_secretary_name, financial_year_end_month, authorised_shares Added to DIRECTOR_EDIT_FIELDS: residential_address_line_1/2, residential_town_city, residential_province, residential_postal_code, postal_address_line_1/2, postal_town_city, postal_province, postal_postal_code, date_of_birth End-to-end tested via proxy PATCH — fields now land in PB. --- app/api/pb/records/[id]/route.ts | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/api/pb/records/[id]/route.ts b/app/api/pb/records/[id]/route.ts index f3d1e93..99068c3 100644 --- a/app/api/pb/records/[id]/route.ts +++ b/app/api/pb/records/[id]/route.ts @@ -15,16 +15,34 @@ const ALLOWED_COLLECTIONS = new Set([ ]); // Fields editable for directors via the in-app edit form. +// (Address fields added 2026-08-18 alongside the onboarding form fields.) const DIRECTOR_EDIT_FIELDS = new Set([ "surname", "first_names", "id_no", "id_no_masked", - "telephone", "email", "postal_address", "residential_address", - "director_type", "notes", "source", + "telephone", "email", "notes", "source", + "residential_address", + "residential_address_line_1", "residential_address_line_2", + "residential_town_city", "residential_province", "residential_postal_code", + "postal_address", + "postal_address_line_1", "postal_address_line_2", + "postal_town_city", "postal_province", "postal_postal_code", + "director_type", + "date_of_birth", ]); // Fields editable for companies via the in-app edit form. +// (Structured address fields + company-level fields added 2026-08-18.) const COMPANY_EDIT_FIELDS = new Set([ "enterprise_no", "enterprise_name", "enterprise_type", - "registration_date", "physical_address", "postal_address", + "registration_date", + "physical_address", + "physical_address_line_1", "physical_address_line_2", + "physical_town_city", "physical_province", "physical_postal_code", + "postal_address", + "postal_address_line_1", "postal_address_line_2", + "postal_town_city", "postal_province", "postal_postal_code", + "company_email", "company_cell_phone", + "public_officer_name", "company_secretary_name", + "financial_year_end_month", "authorised_shares", "director", "notes", "source", "sars_login_username", "sars_login_password", "sars_paye_no", "sars_vat_no", "sars_tax_number",