- Fix syntax errors and logic in MediaManager.html - Fix SpreadsheetApp mocking in mediaHandlers.test.ts - Add SKU logic migration plan and backfill script - Update Product.ts and global.ts exports - Update newSku.ts and add newSku.test.ts - Ensure all tests pass (71/71)
68 lines
2.5 KiB
Markdown
68 lines
2.5 KiB
Markdown
# SKU logic migration plan
|
|
|
|
2026-01-03
|
|
|
|
## Summary
|
|
|
|
The goal of this migration is to reduce the number of touchpoints required to create a new SKU. User should only have to define `product_type` and `product_style` once, and then a new SKU should be created automatically when needed.
|
|
|
|
## High Level Migration Steps
|
|
|
|
1. FREEZE CHANGES to the spreadsheet while this migration is in progress
|
|
2. Remove `sku_prefix` column from `product_inventory` sheet. This will disable the existing automation by removing one of the needed inputs that is controlled by an instant ARRAYFORMULA.
|
|
3. Update column names in `product_inventory` and `values` sheets to match new SKU logic
|
|
4. Update `newSku.ts` to use new SKU logic
|
|
5. Update `MediaManager.ts` to use new SKU logic
|
|
|
|
## Detailed Migration Steps
|
|
|
|
## `product_inventory` sheet
|
|
|
|
* [x] Remove `sku_prefix` column
|
|
* [x] Change `type` to `product_style`
|
|
* [x] Move `product_style` column to the right of `product_type`
|
|
* [x] Remove `function` column
|
|
* [x] Remove `#` column
|
|
* [x] Remove `style` column
|
|
* This column is not currently used in any active way, and is confusingly named. It should be removed.
|
|
|
|
## `values` sheet
|
|
|
|
* [x] Add `sku_prefix` column
|
|
* [x] `type_sku_code` -> `sku_suffix` column
|
|
* [x] Remove `function` and `function_sku_code` columns
|
|
* [x] `type` -> `product_style`
|
|
|
|
## `product_types` sheet
|
|
|
|
* [x] Remove `function` column
|
|
* [x] Change `type` to `product_style`
|
|
|
|
## `Product` class
|
|
|
|
* [x] Rename `type` -> `product_style` (to match the plan).
|
|
* [x] Remove `function` property.
|
|
* [x] Remove the existing `style: string[]` property (Line 24).
|
|
|
|
## newSku.ts
|
|
|
|
* [x] Move manual trigger to `sku` column
|
|
* [ ] Add safety check to ensure that existing `sku` values are not overwritten. If the product already has a `sku` in Shopify, use it. Only check if `sku` is empty and `shopify_id` is defined.
|
|
* [x] Start using `product_type` -> `sku_prefix` lookup + `product_style` -> `sku_suffix` lookup for SKU code
|
|
|
|
## Media Manager
|
|
|
|
* [ ] If `product_type` and `product_style` are defined, but `sku` is not, request a new SKU after confirming values are correct
|
|
* [ ] If either `product_type` or `product_style` are undefined, prompt the user to define them, then request a new SKU
|
|
|
|
## Cleanup
|
|
|
|
* Scrub code for columns that have been removed
|
|
* [x] `function` column
|
|
* [x] `function_sku_code` column
|
|
* [x] `type_sku_code` column
|
|
* [x] `#` column
|
|
* [x] `style` column
|
|
* [x] Scrub code for logic that has been removed
|
|
* [x] Backfill
|