# Backend — PROGRESS (Phase 1: Inventory & Supply Chain) Legend: `[ ]` not started · `[~]` in progress · `[x]` done Spec: `docs/10-BACKEND-PHASE1.md` (model + rules) · `docs/11-BACKEND-PHASE1.md` (API) Convention: `docs/01-DOC-GUIDE.md §6`. Update this file in the **same commit** as the code. When ticking `[x]`, append a short note + any deviation. ## 0. Bootstrap - [ ] Solution + Web API project (`net10.0`), packages restored (00-CORE §5.4) - [ ] Folder structure per 00-CORE §5.3 - [ ] `ErpDbContext` + Npgsql wired; `InitialCreate` migration applied - [ ] Serilog, JWT, Swagger, HealthChecks, ProblemDetails in `Program.cs` - [ ] `IUnitOfWork` + `UnitOfWork` (transaction boundary) - [ ] Generic repository base + interfaces - [ ] `ICurrentUser` (audit stamp from token `sub`) - [ ] ProblemDetails middleware + domain exception → `code` mapping (System/Errors) ## 1. Master Data - [ ] Item: entity + config + enums (ItemType, TrackingMode) - [ ] Item: repository + service + controller (CRUD, DTOs, ETag) - [ ] UOM + UOM conversions - [ ] Category (hierarchy, `?tree=true`) - [ ] Vendor - [ ] Warehouse + Bin - [ ] Item reorder settings (`PUT /items/{id}/reorder`) ## 2. Procurement - [ ] Requisition (+ lines) + submit - [ ] RFQ + quotations + comparison - [ ] Purchase Order: create (auto-approve, `approvalRequired` flag), edit-while-open, approve (no-op), cancel - [ ] Purchase Return (outbound movement, reason code) ## 3. Goods Receipt - [ ] GRN create (against PO / direct), over-receipt tolerance - [ ] GRN confirm → FIFO layer + ledger + PO `qtyReceived` (single UoW txn, Idempotency-Key) - [ ] Inspection hold release / reject ## 4. Stock Core - [ ] StockLayer + StockLedger entities/config (ledger append-only) - [ ] `FifoCostingService` (consume oldest-first with row lock; valuation) - [ ] Stock enquiry (onHand / available / onHold / inTransit) - [ ] Ledger query · Valuation query ## 5. Stock Transactions - [ ] Transfer: create → dispatch (consume, In-Transit) → receive (dest layer, cost-preserving) - [ ] Adjustment (auto-post, mandatory reason code) - [ ] Count (cycle/full → enter counts → variance → post) - [ ] Reorder alerts (query) + suggest requisition ## 6. Cross-cutting - [ ] Audit log on every mutation (who/when/old→new) - [ ] Document numbering sequences (per type, per year) - [ ] Auth: simple in-app login → JWT (`POST /auth/login`) - [ ] JournalEntryStub emitted per stock movement (data only) - [ ] Negative-stock policy enforcement (default block) - [ ] FEFO picking for perishables; block expired / on-hold issue ## Deferred (Phase 2+ — do NOT build now, hooks only) - [ ] Vendor invoice + three-way match - [ ] Reservation/allocation fulfilment - [ ] RBAC policy enforcement + approval workflow activation ## Done