feat(notif-inventory-alerts): admin bell: add inventory alerts (low stock, out of stock, expired/expiring, low margin)
This commit is contained in:
@@ -592,3 +592,16 @@
|
||||
- Tickets relacionados dejados pending en backlog: TPV-MANIFEST-PATH (high), TPV-POS-SALES-500 (high), TPV-FAVICON-404 (low).
|
||||
- Acción operacional para el operador del host remoto: `kill -TERM <PID-dev>` sobre el dev process que está sirviendo tpv-mv.rikrdo.com → `monolith.sh prod restart`. El nuevo smoke test impedirá futuros deploys con dev mode accidental.
|
||||
- Artefactos: work/artifacts/TPV-DEV-IN-PROD/ (architect.md, implementer.md, reviewer.json, security.json, qa.json, documenter.md, leader-close.json)
|
||||
|
||||
## 2026-08-27 — NOTIF-INVENTORY-ALERTS cerrada (campanita admin: alertas de inventario) — DONE
|
||||
- Gates: reviewer APPROVED, security APPROVED, qa APPROVED, verify.sh exit 0
|
||||
- Entregable: campanita del admin (`OrderNotifications`) ahora tiene 3 tabs. Nuevo tab "🏷️ Inventario" muestra 5 alertas operativas: stock bajo (<5), sin stock (=0), caducados (expiration_date < today), por caducar (≤30d), margen <30%.
|
||||
- Backend: nuevo endpoint `GET /api/inventory/admin/notifications` (admin role) que devuelve `{ items, total }`. CTE idéntica al overview para garantizar consistencia entre campanita y filtros del inventario. Nuevo filtro `expired` añadido a `inventoryOverviewFilterSchema` + helpers.
|
||||
- Frontend: `OrderNotifications.tsx` extendido con `TabInventory()`, tercer botón de tab, fetch paralelo en `Promise.all` con los otros 2 endpoints. `api-client.ts` con método `inventoryApi.notificationCounts()`.
|
||||
- Tests: 5/5 unit tests pasan en 106ms. Backend typecheck verde. Admin build verde.
|
||||
- Scope: 4 archivos, 333 líneas añadidas. Cero nuevas deps. Cero cambios en CORS/auth/cookies.
|
||||
- Coherencia: el filtro `expired` (expiration_date < current_date) NO existía antes; los otros 4 reutilizan lógica ya probada.
|
||||
- Decisiones: umbrales hardcoded (5/30d/30%) por consistencia con filtros existentes. No se añadieron emails (solo in-app). Se añadió "Por caducar" además de "Caducados" para gestión proactiva (revisable en QA si molesta).
|
||||
- Tickets relacionados siguen pending: TPV-MANIFEST-PATH, TPV-POS-SALES-500, TPV-FAVICON-404.
|
||||
- Pre-existing: 1 test failure en `pos/tests/payment-allocation.test.ts > rejects overpayments while still under total` — verificado que NO es regresión de este feature (falla idéntico sin los cambios).
|
||||
- Artefactos: work/artifacts/NOTIF-INVENTORY-ALERTS/ (architect.md, implementer.md, reviewer.json, security.json, qa.json, documenter.md, leader-close.json)
|
||||
|
||||
Reference in New Issue
Block a user