feat(po): catalogue line items on approval + move /inventory/{items,vendors} ? /catalogue #108

Merged
shad0w merged 3 commits from feat/catalog-on-approval into master 2026-06-23 23:47:50 +00:00
Owner

Two related catalogue changes.

1. Register line items in the catalogue on approval (keeps both triggers)

The catalogue sync (syncProductCatalog — auto-create a Product for unknown line items, link them, upsert last/per-vendor prices) previously ran only at full payment, so an approved-but-unpaid PO's items weren't in the catalogue for reuse (the staging report: PMS/HOFC/9030/2026-27).

  • Extracted syncProductCatalog into lib/product-catalog.ts.
  • approvePo now calls it so approved items are immediately reusable.
  • Both triggers kept — payment (markPaid) still re-syncs to refresh final prices. (POs approved before this ships still get catalogued when they're paid.) Idempotent.

2. Rename routes /inventory/{items,vendors} → /catalogue/{items,vendors}

  • Moved the items + vendors pages (incl. their [id] detail pages) into /catalogue (git-tracked renames, history preserved). /inventory/cart is unchanged.
  • Updated all internal links, revalidatePath calls, sidebar nav, CLAUDE.md, and tests; renamed tests/e2e/inventory → tests/e2e/catalogue.
  • No redirects — the old /inventory/{items,vendors} paths are intentionally left free for a future feature.

Verification

  • New integration test (approving a free-text-line PO creates + links the product and records the per-vendor price).
  • tsc --noEmit clean; full integration (264) and unit (272) suites green.

🤖 Generated with Claude Code

Two related catalogue changes. ## 1. Register line items in the catalogue on **approval** (keeps both triggers) The catalogue sync (`syncProductCatalog` — auto-create a `Product` for unknown line items, link them, upsert last/per-vendor prices) previously ran **only at full payment**, so an approved-but-unpaid PO's items weren't in the catalogue for reuse (the staging report: `PMS/HOFC/9030/2026-27`). - Extracted `syncProductCatalog` into **`lib/product-catalog.ts`**. - **`approvePo` now calls it** so approved items are immediately reusable. - **Both triggers kept** — payment (`markPaid`) still re-syncs to refresh final prices. (POs approved *before* this ships still get catalogued when they're paid.) Idempotent. ## 2. Rename routes `/inventory/{items,vendors}` → `/catalogue/{items,vendors}` - Moved the items + vendors pages (incl. their `[id]` detail pages) into `/catalogue` (git-tracked renames, history preserved). **`/inventory/cart` is unchanged.** - Updated all internal links, `revalidatePath` calls, sidebar nav, CLAUDE.md, and tests; renamed `tests/e2e/inventory` → `tests/e2e/catalogue`. - **No redirects** — the old `/inventory/{items,vendors}` paths are intentionally left free for a future feature. ## Verification - New integration test (approving a free-text-line PO creates + links the product and records the per-vendor price). - `tsc --noEmit` clean; full integration (264) and unit (272) suites green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
shad0w added 1 commit 2026-06-23 23:30:06 +00:00
feat(po): register line items in the product catalogue on approval
All checks were successful
PR checks / checks (pull_request) Successful in 43s
PR checks / integration (pull_request) Successful in 31s
70f3230c36
Previously a PO's free-text line items only became reusable catalogue products
(/inventory/items) on full payment (markPaid → syncProductCatalog). An approved-
but-unpaid PO's items weren't selectable for further POs yet.

- extract syncProductCatalog into lib/product-catalog.ts (shared).
- call it from approvePo so approved items are immediately catalogued (create
  product by name if unknown, link the line item, upsert last/per-vendor price);
  payment still re-syncs to refresh prices. Idempotent.
- test: approving a PO with a free-text line creates + links the product and
  records the per-vendor price.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shad0w added 1 commit 2026-06-23 23:34:31 +00:00
refactor(routes): move /inventory/{items,vendors} → /catalogue/{items,vendors}
All checks were successful
PR checks / checks (pull_request) Successful in 44s
PR checks / integration (pull_request) Successful in 31s
d7b455ab7d
Renames the product-catalogue pages (items + vendors, incl. their [id] detail
pages) out of /inventory into /catalogue. /inventory/cart is unchanged. All
internal links, redirects, revalidatePath calls, sidebar nav, and tests are
updated; next.config redirects keep old /inventory/{items,vendors}[/...] URLs
working (permanent) so existing bookmarks don't 404.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shad0w changed title from feat(po): register line items in the product catalogue on approval to feat(po): catalogue line items on approval + move /inventory/{items,vendors} ? /catalogue 2026-06-23 23:34:47 +00:00
shad0w added 1 commit 2026-06-23 23:36:46 +00:00
chore: rename e2e folder to catalogue + drop /inventory redirects
All checks were successful
PR checks / checks (pull_request) Successful in 43s
PR checks / integration (pull_request) Successful in 31s
2bdf3a6536
- tests/e2e/inventory → tests/e2e/catalogue (folder name only; playwright globs
  ./tests/e2e so nothing else changes).
- remove the next.config redirects from /inventory/{items,vendors}: the old
  routes are intentionally left free for a future feature.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shad0w merged commit c710fe5d73 into master 2026-06-23 23:47:50 +00:00
Sign in to join this conversation.
No description provided.