hotfix: corrige 500 en /customers y /historical-sales
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled

- customers_bp: last_purchase no existe como columna; se calcula via subquery a sales.
- pos_bp: historical_sales no existe en tenants sin importacion; endpoint devuelve lista vacia en lugar de 500.
- Servicio reiniciado y validado.

Tests: 35 passed
This commit is contained in:
2026-06-30 08:20:04 +00:00
parent 2bdeb2973a
commit 70a600cc66
2 changed files with 12 additions and 1 deletions

View File

@@ -80,7 +80,8 @@ def list_customers():
SELECT c.id, c.name, c.rfc, c.razon_social, c.phone, c.email,
c.address, c.cp,
c.price_tier, c.credit_limit, c.credit_balance, c.vehicle_info,
c.branch_id, c.is_active, c.created_at, c.last_purchase
c.branch_id, c.is_active, c.created_at,
(SELECT MAX(s.created_at) FROM sales s WHERE s.customer_id = c.id) AS last_purchase
FROM customers c
WHERE {where}
ORDER BY c.name