Add product seed CSV template

This commit is contained in:
beatz174-bit
2025-11-23 09:37:33 +10:00
parent 22a64c7ccd
commit d692c4ce74
2 changed files with 22 additions and 0 deletions
+18
View File
@@ -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.
+4
View File
@@ -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
1 name category unit_type bulk_name units_per_bulk barcode archived
2 Sparkling Water 500ml Drinks units carton 24 012345678905 false
3 Salted Chips 50g Snacks units carton 48 023456789012 false
4 Chocolate Bar Confectionery units box 30 034567890129 false