catalog: schema v3 — fitment, oemNumbers, priceUpdatedAt, availability tri-state #41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
packages/catalog/index.tsis atschemaVersion: 2and already carriesbrand,partNumber,category,price,weightGrams,inStock,shippable,installService. The approved mockups need four things it does not have. Both schemas are.strict()and the store re-parses at build time, so this is a lockstep producer+consumer bump — bump toschemaVersion: 3, no v2 compatibility branch, exactly as #34 did for v2.Fields
fitment: string[]— free-text vehicle strings ("Toyota Avanza 1.3 / 1.5 (2012–2021)"), rendered as the mockup's Kecocokan kendaraan list and the source of the Kendaraan filter facet in #46. Free text, not a year/engine/trim matrix —docs/store-overhaul-spec.mdrejects the matrix explicitly.oemNumbers: string[]— cross-reference numbers besidepartNumber. Empty array, never null, so consumers need no null branch.priceUpdatedAt: string | null— ISO date backing the spec's recommended "harga per 12 Agustus 2026" treatment. Null whenpriceis null.availability: "ready" | "indent" | "habis"— replaces the booleaninStock. This is the schema's whole reason to bump:indent(orderable but not stocked) is a state the boolean cannot express, and the pesanan sparepart flow in the spec depends on it. Still no stock count — see #40 item 1.Migration of
inStockinStockis deleted, not kept alongside. Consumers to update in the same change:ProductJSON-LDavailabilityinapps/store/app/products/[slug]/page.tsx, theHabisbadge inproduct-card.tsx, the stock badge on the detail page, and the!inStockdisabled branch inadd-to-cart.tsx(which must now distinguishindentfromhabis—indentis orderable).Acceptance
pnpm --filter @garage/catalog testpasses with new cases: a v2 payload is rejected with the existingUnsupported catalog schema versionmessage;availabilityoutside the enum is rejected;fitment/oemNumbersreject non-string members;priceUpdatedAtrejects a non-ISO string and rejects being set whilepriceis null. The duplicate-slugsuperRefineand slug sort still hold.apps/store/scripts/wait-for-catalog.mtsstill gates the deploy on schema compatibility, so #42 must land before the store build can succeed against production.