- Add distance_km field to NodeType (used by nearestHubs)
- Add distance_km field to OfferNodeType (used by nearestOffers)
- Expand SupplierType with name, latitude, longitude, distance_km
- Fix nearestSuppliers to return full supplier info from nodes collection
- Fix nearestHubs and nearestOffers to pass distance_km to constructors
This fixes 8 failed integration tests for nearest* endpoints.
Resolves: Cannot query field 'distanceKm' on type 'NodeType/OfferNodeType'
Created test suite covering all 8 main geo service endpoints:
- Basic: products, nodes (with filters/bounds), clusteredNodes
- Nearest: nearestHubs, nearestOffers, nearestSuppliers (with product filters)
- Routing: routeToCoordinate, autoRoute, railRoute
- Edge cases: invalid coordinates, zero radius, nonexistent UUIDs
Test suite uses real API calls to production GraphQL endpoint.
16 tests total across 4 test classes.
Files:
- tests/test_graphql_endpoints.py: Main test suite (600+ lines)
- tests/README.md: Documentation and usage guide
- pytest.ini: Pytest configuration
- run_tests.sh: Convenience script to run tests
- pyproject.toml: Added pytest and requests as dev dependencies
Remove supplier_name field from OfferNodeType constructor in resolve_nearest_offers - this field does not exist in the type definition and causes 400 errors.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add nearestHubs(lat, lon, radius, productUuid?) - hubs near coordinates
- Add nearestOffers(lat, lon, radius, productUuid?) - offers near coordinates
- Add nearestSuppliers(lat, lon, radius, productUuid?) - suppliers near coordinates
- Add routeToCoordinate(offerUuid, lat, lon) - route from offer to coordinates
These unified endpoints work with coordinates instead of UUIDs, simplifying
the frontend logic by removing the need for entity-specific queries like
GetProductsNearHub, GetHubsNearOffer, etc.
- Remove find_routes, find_product_routes, delivery_to_hub queries
- Rename offers_to_hub → offers_by_hub with proper phase-based routing (auto → rail* → auto)
- Add offer_to_hub query for single offer to hub connection
- Both new queries use Dijkstra-like search with transport phases
- findProductsForHub: find products deliverable to a hub
- findHubsForProduct: find hubs where product can be delivered
- findSupplierProductHubs: find hubs for supplier's product
- findOffersForHubByProduct: find offers with routes (wrapper for findProductRoutes)
Offer edges connect offer nodes to locations and are not
transport stages. Filter them out in _build_route_from_edges()
to avoid showing 0km "offer" steps in the route stepper.