Repository navigation
Add shipping and customs fields to products - #158
Merged
Merged
Conversation
Products get optional HS code, country of origin (ISO 3166-1 alpha-2), length, width and height in mm, and weight in g. The columns are added with addColumnIfMissing and have no default, so existing products keep their data and simply have the new fields empty. Fresh installs get them in the CREATE TABLE statements. Empty strings, invalid and negative numbers are stored as NULL, and the country code is uppercased. Passing null on update clears a field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a "Shipping & Customs" section to the create, edit and detail pages with HS code, country of origin, dimensions and weight. The products list and invoice forms are unchanged; the fields only appear on the product pages. Empty inputs are sent as "" / null, so clearing a field on the edit page removes the stored value. The country input only accepts two letters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Invoice items now carry a snapshot of their product's HS code, country of origin, dimensions and weight, and GET /api/v1/invoices/:id (as well as the create, update and duplicate responses) always includes all six fields, null when not set. - Creating an invoice or saving a draft copies the product's current values onto each item - Editing an issued invoice (protection override) keeps the values the items already had, so issued invoices stay unchanged - Duplicating takes the current product values, falling back to the original item's values if the product no longer exists The invoice_items columns are added with addColumnIfMissing and no default, so existing invoices are untouched and return null for the new fields. Public share links do not include them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
@kittendevv anything I can do for you to get this merged? |
Owner
|
Was in the proccess of merging this but i forgor mb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Products can now store the data you need for shipping and customs paperwork: HS code, country of origin, dimensions and weight. Invoice items keep a copy of these values taken when the invoice is saved. That keeps issued invoices stable and lets API users build customs documents or shipping labels from an invoice.
Changes
Products
hsCode: HS codecountryOfOrigin: ISO 3166-1 alpha-2, stored in uppercaselengthMm,widthMm,heightMm: dimensions in mmweightG: weight in gNULL.nullclears a field. Leaving a field out keeps its current value.Invoice items
GET /api/v1/invoices/:idreturns all six fields on every item, as do the create, update and duplicate responses. Fields that aren't set arenull.Database
productsandinvoice_items, added withaddColumnIfMissingand no default value.null.productscolumns directly in theCREATE TABLEstatements.Testing
deis saved asDE, and negative or invalid numbers are ignorednullfor the new fields🤖 Generated with Claude Code