Skip to content

Add restocking feature with budget recommendations and order submission - #239

Open
Ge0f3 wants to merge 1 commit into
beck-source:mainfrom
Ge0f3:geo/new_features
Open

Add restocking feature with budget recommendations and order submission#239
Ge0f3 wants to merge 1 commit into
beck-source:mainfrom
Ge0f3:geo/new_features

Conversation

@Ge0f3

@Ge0f3 Ge0f3 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Adds a Restocking feature: users set a budget, get prioritized restock recommendations, and submit restock orders that persist to disk. Submitted orders then surface on the Orders page.

Backend

  • GET /api/restocking/recommendationsbudget required; supports warehouse/category filters
  • GET|POST /api/restocking/orders — the only write endpoint; persists to server/data/restock_orders.json
    • Atomic write (temp file + os.replace) so a crash mid-write can't leave truncated JSON
    • A lock serializes the read-modify-write so concurrent POSTs can't collide on ids
    • Writes to disk before publishing in-memory, so a failed write can't leave a phantom order visible in the API

Frontend

  • New Restocking view + route and api.js client methods
  • Orders page gains a Submitted Orders card. It intentionally ignores the global filter bar (the year/status options don't apply to just-submitted, multi-warehouse restock orders) — matching the existing precedent of /api/demand and /api/backlog
  • Its own error state so a not-yet-restarted backend degrades just that section instead of blanking the whole Orders page

Other

  • en/ja i18n strings
  • Architecture docs under docs/
  • Backend test suite (tests/backend/test_restocking.py)

Testing

  • Verified all 7 nav tabs load via Playwright; Restocking route renders
  • Backend test suite added for the new endpoints

🤖 Generated with Claude Code

Adds a Restocking tab where users set a budget and get prioritized restock
recommendations, then submit restock orders that persist to disk.

Backend:
- GET /api/restocking/recommendations (budget required; warehouse/category filters)
- GET|POST /api/restocking/orders — the only write endpoint, persists to
  server/data/restock_orders.json with atomic writes and a lock to keep
  concurrent POSTs from colliding on ids
- New Restocking.vue view and route; api.js client methods

Orders:
- New "Submitted Orders" card listing restock orders, intentionally
  filter-independent (like /api/demand and /api/backlog)

Also adds en/ja i18n strings, architecture docs, and a backend test suite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant