From f9aac2db37e4834699bfa0e7b688448dccf072b8 Mon Sep 17 00:00:00 2001 From: ERP-System Date: Mon, 8 Jun 2026 13:45:04 +0400 Subject: [PATCH] fix(vehicles): serialize booleans as 1/0 in multipart payload The vehicle form uploads as multipart/form-data for the image, and the FormData builder stringified every value, turning has_insurance=false into the literal "false". Laravel's boolean rule rejects "true"/"false" strings, producing "The has insurance field must be true or false." Serialize booleans as "1"/"0" so they validate; null values remain skipped (nullable). Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/api/src/clients/vehicles.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/api/src/clients/vehicles.ts b/packages/api/src/clients/vehicles.ts index 9a18810..c667ec0 100644 --- a/packages/api/src/clients/vehicles.ts +++ b/packages/api/src/clients/vehicles.ts @@ -20,6 +20,10 @@ function buildVehicleFormData(payload: Record): FormData { if (value == null) continue if (value instanceof File) { fd.append(key, value) + } else if (typeof value === "boolean") { + // Laravel's `boolean` rule rejects the strings "true"/"false"; + // serialize as "1"/"0" so multipart payloads validate correctly. + fd.append(key, value ? "1" : "0") } else { fd.append(key, String(value)) }