From d692c4ce7452e30f739531a031541213649eaa62 Mon Sep 17 00:00:00 2001 From: beatz174-bit Date: Sun, 23 Nov 2025 09:37:33 +1000 Subject: [PATCH] Add product seed CSV template --- docs/seed/README.md | 18 ++++++++++++++++++ docs/seed/products_seed_template.csv | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 docs/seed/README.md create mode 100644 docs/seed/products_seed_template.csv diff --git a/docs/seed/README.md b/docs/seed/README.md new file mode 100644 index 0000000..445e8e4 --- /dev/null +++ b/docs/seed/README.md @@ -0,0 +1,18 @@ +# Product seed CSV template + +Use `products_seed_template.csv` to author product seed data that can be imported into the Dexie database. Populate one row per product and ensure the `category` column contains the product's category name. + +## Columns +- **name**: Product display name. +- **category**: Category label for the product. Codex will generate the category table from the unique values in this column. +- **unit_type**: Unit of measure (e.g., `units`, `packs`, `bottles`). +- **bulk_name**: Label for the bulk unit (e.g., `carton`, `box`). +- **units_per_bulk**: Number of individual units contained in a bulk item. +- **barcode**: Optional barcode string. Leave blank if unknown. +- **archived**: `true` or `false` to indicate whether the product is archived. + +## Usage flow for Codex +1. Read `products_seed_template.csv`. +2. Seed `products` with the CSV rows (generate UUIDs and timestamps per record). +3. Build a **unique, alphabetized** list of categories from the `category` column and seed the `categories` table with those values (UUIDs plus timestamps). +4. If necessary, seed `areas` separately using the existing defaults in `src/db/seed.ts` or an equivalent CSV. diff --git a/docs/seed/products_seed_template.csv b/docs/seed/products_seed_template.csv new file mode 100644 index 0000000..2bb3017 --- /dev/null +++ b/docs/seed/products_seed_template.csv @@ -0,0 +1,4 @@ +name,category,unit_type,bulk_name,units_per_bulk,barcode,archived +Sparkling Water 500ml,Drinks,units,carton,24,012345678905,false +Salted Chips 50g,Snacks,units,carton,48,023456789012,false +Chocolate Bar,Confectionery,units,box,30,034567890129,false