Repository navigation
fix(pedidos): isolate Pedidos/Fiados/Alertas filters server-side - #4
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ged) - Add missing use-reconnect-handler hook for online refetch. - Restore precios state declarations in clientes-client needed after rebase.
casasleonj
force-pushed
the
pr/3-isolate-pedidos-tab-filters
branch
from
July 13, 2026 14:12
67486ad to
66e81da
Compare
casasleonj
added a commit
that referenced
this pull request
Aug 23, 2026
#4) Los helpers puros de POST /api/embarques/auto (unidadesPedido, pesoPedido, splitPedidosByCapacity) estaban inline y sin test unitario — su única cobertura era E2E contra Postgres. Se extraen a src/lib/embarque-auto.ts y se testean (10 tests): unidades, peso, y el chunking greedy por capacidad (incluye pedido > maxUnidades, orden, llenado exacto). Cierra la parte de lógica pura de A.10 #4. Verificado: 255 tests, tsc limpio.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué
Separa los datasets de Pedidos, Fiados y Alertas para que los filtros de una pestaña no afecten las otras.
Problema
/api/pedidos?all=truetiene un hard-cap de 200 registros. Los filtros de la pestaña "Pedidos" (fechas, estado, etc.) se aplicaban al dataset compartido, por lo que Fiados/Alertas podían perder pedidos relevantes o mostrar contadores incorrectos.Cambios
src/modules/pedidos/domain/repositories/IPedidoRepository.tssrc/modules/pedidos/application/dto/index.tssrc/modules/pedidos/application/use-cases/ListarPedidosUseCase.tssrc/modules/pedidos/infrastructure/repositories/PrismaPedidoRepository.tsscope?: 'fiados' | 'alertas'al filtro.scope=fiadosfiltra server-side:estadoEntrega='ENTREGADO',saldo > 0,clienteId != CONSUMIDOR_FINAL.src/app/api/pedidos/route.ts: parsea?scope=....src/hooks/use-pedidos.ts: acepta y envíascope.src/app/(app)/pedidos/pedidos-client/fiados-table.tsxsrc/app/(app)/pedidos/pedidos-client/alertas-table.tsxonCountChangepara los badges de las pestañas.src/app/(app)/pedidos/pedidos-client/index.tsxVerificación
npx tsc --noEmitpasa.npm run test -- --run→ 1836 tests passed.e2e/pedidos-filtros-funcionales.spec.tsye2e/fiados-trazabilidad.spec.tspasan.