Add LPG bi-fuel and hydrogen fuel types
Add petrol_lpg, diesel_lpg and hydrogen to the fuel_type choices, across the six places that define them: the PocketBase schema, the car form and detail view in both the Web App and the Phone App, and the two doc comments that enumerate the values. The Go API needed no change — it passes fuel_type through as a free string, so PocketBase is the only validator. Model the LPG conversions as their own choices rather than a separate "has LPG" flag: the car runs on either tank, so "petrol + LPG" is what an owner picks it out as. Order each variant next to its base fuel so the dropdowns read naturally. Purely additive — existing rows keep their values and need no migration. The live PocketBase schema does still need scripts/setup-pocketbase.mjs re-run before the new choices will save, since its select field allows only the old four; the script reconciles select values on existing fields, so re-running migrates it in place. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
98acd7d121
commit
f77cbf0e73
@@ -54,7 +54,7 @@ type Car struct {
|
||||
BrakeFluidSpec string `json:"brakeFluidSpec"` // e.g. "DOT 4"
|
||||
CoolantSpec string `json:"coolantSpec"` // e.g. "Toyota Super Long Life Coolant"
|
||||
|
||||
FuelType string `json:"fuelType"` // petrol | diesel | hybrid | electric
|
||||
FuelType string `json:"fuelType"` // petrol | petrol_lpg | diesel | diesel_lpg | hybrid | electric | hydrogen
|
||||
BuildDate string `json:"buildDate"` // ISO YYYY-MM-DD (date-only)
|
||||
FirstRegistrationDate string `json:"firstRegistrationDate"` // ISO YYYY-MM-DD (date-only)
|
||||
|
||||
|
||||
@@ -245,7 +245,17 @@ const DESIRED = {
|
||||
F.text("brake_fluid_spec"),
|
||||
F.text("coolant_spec"),
|
||||
F.number("current_km"),
|
||||
F.select("fuel_type", ["petrol", "diesel", "hybrid", "electric"]),
|
||||
// Bi-fuel LPG conversions are their own choice rather than a flag: the car
|
||||
// runs on either tank, so "petrol + LPG" is what an owner picks it out as.
|
||||
F.select("fuel_type", [
|
||||
"petrol",
|
||||
"petrol_lpg",
|
||||
"diesel",
|
||||
"diesel_lpg",
|
||||
"hybrid",
|
||||
"electric",
|
||||
"hydrogen",
|
||||
]),
|
||||
F.text("build_date"), // ISO YYYY-MM-DD (date-only; VIN 10th digit ≈ model year)
|
||||
F.text("first_registration_date"), // ISO YYYY-MM-DD
|
||||
// Owner of this car. Non-cascading on purpose: deleting a user must not
|
||||
|
||||
Reference in New Issue
Block a user