feat(logistics): matching capacidad<->traslado (backend #107)#134
Merged
Conversation
…107) Cierra el bucle logístico: dado un Shipment que mueve carga A→B, sugerir las TransportCapacity (#105) compatibles y ordenadas. - window-overlap: extrae el helper de solapamiento de ventana a un módulo puro compartido (capacityWindowOverlaps) y lo reutiliza el repo in-memory. - capacity-match: filtro de compatibilidad (modo, capacidad≥carga por dimensión, ventana, restricciones) + ranking (nodo exacto > proximidad haversine > área/sin-coords, desempate por holgura). Reutiliza la haversine de shared/domain/geo-distance. - shipment-match-criteria: deriva los criterios del Shipment (hoy abiertos: sin modo/carga/ventana/restricciones — no inventa datos). - ResourceLocationLookup: puerto + adapter drizzle (lee resources) e in-memory, espejo del NeedLookup de offers para resolver coords del origen. - SuggestCapacitiesForShipment: orquesta carga → filtro → ranking → CapacityView. Cubierto por specs (TDD): 25 casos (matcher puro + caso de uso).
#107) GET /logistics/shipments/{id}/capacity-suggestions → CapacityView[] ordenado. Autz: coordinación (@RequirePermission('shipment:read')), mismo patrón que el flujo de asignar capacidad. Reutiliza el mapper capacity-view (#105). - ShipmentController: nueva ruta + inyección de SuggestCapacitiesForShipment. - LogisticsModule: providers del caso de uso y del ResourceLocationLookup. - int-spec del DrizzleResourceLocationLookup contra Postgres. - gen:api: regenerado openapi.json y api-client/schema.ts (ruta presente). - Formato prettier del matcher/caso de uso.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Backend de #107. Cierra el bucle logistico: dado un Shipment (#106) que necesita mover carga A->B, sugiere las TransportCapacity (#105) compatibles. Analogo logistico del matching oferta<->necesidad.
Caso de uso SuggestCapacitiesForShipment (solo capa de aplicacion; sin agregado ni migracion): filtra por emergencia + status=available, y cuando el Shipment lo declara, por mode / capacidad>=carga (por dimension) / solape de ventana (mismo helper que ListCapacities #105) / constraints (subconjunto). Coverage NUNCA excluye en duro: rankea (decision abierta del issue -> nodos/area + cercania, geometria de corredor diferida a cuando entren los hubs #108). Orden: tier (match exacto de resourceId > coords resolubles > area/sin coords), luego haversine ascendente (reusa haversineMeters del shared kernel, el mismo de /nearby), desempate por menor holgura de capacidad.
Endpoint GET /logistics/shipments/{id}/capacity-suggestions -> CapacityView[] rankeado, permiso shipment:read (consistente con asignar capacidad a una expedicion). Puerto minimo ResourceLocationLookup (resuelve resourceId->lat/lng contra la tabla resources, como el NeedLookup de offers). gen:api regenerado. TDD: 25 tests nuevos + int-spec. Gate verde: 994/994 tests.
Cierra el EPIC de backend logistico (#105 capacidad + #106 expedicion + #107 matching). Los frontends (form 'Ofrezco transporte', panel de expediciones + vista transportista, sugerencias en la expedicion) van en PRs aparte.