Fix geo GraphQL schema mismatch: camelCase → snake_case
All checks were successful
Build Docker Image / build (push) Successful in 5m46s
All checks were successful
Build Docker Image / build (push) Successful in 5m46s
All geo .graphql operations and consuming code updated to match server schema which uses snake_case field/argument names. Removed non-existent QuoteCalculations query, using NearestOffers instead.
This commit is contained in:
@@ -85,7 +85,7 @@ interface RoutePathType {
|
||||
stages?: (RouteStage | null)[]
|
||||
}
|
||||
import { GetOfferDocument, GetSupplierProfileByTeamDocument, type GetOfferQueryResult, type GetSupplierProfileByTeamQueryResult } from '~/composables/graphql/public/exchange-generated'
|
||||
import type { OfferWithRouteType, RouteStageType } from '~/composables/graphql/public/geo-generated'
|
||||
import type { OfferWithRoute, RouteStage } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
const route = useRoute()
|
||||
const localePath = useLocalePath()
|
||||
@@ -152,17 +152,17 @@ const fetchOffersByHub = async () => {
|
||||
'geo'
|
||||
)
|
||||
|
||||
const offers = offersResponse?.nearestOffers || []
|
||||
const offers = offersResponse?.nearest_offers || []
|
||||
|
||||
// Offers already include routes from backend
|
||||
const offersWithRoutes = offers
|
||||
.filter((offer): offer is NonNullable<OfferWithRouteType> => offer !== null)
|
||||
.filter((offer): offer is NonNullable<OfferWithRoute> => offer !== null)
|
||||
.map((offer) => ({
|
||||
sourceUuid: offer.uuid,
|
||||
sourceName: offer.productName,
|
||||
sourceName: offer.product_name,
|
||||
sourceLat: offer.latitude,
|
||||
sourceLon: offer.longitude,
|
||||
distanceKm: offer.distanceKm,
|
||||
distanceKm: offer.distance_km,
|
||||
routes: offer.routes || []
|
||||
}))
|
||||
|
||||
@@ -207,12 +207,12 @@ const getRouteStages = (option: ProductRouteOption) => {
|
||||
const route = option.routes?.[0]
|
||||
if (!route?.stages) return []
|
||||
return route.stages
|
||||
.filter((stage): stage is NonNullable<RouteStageType> => stage !== null)
|
||||
.filter((stage): stage is NonNullable<RouteStage> => stage !== null)
|
||||
.map((stage) => ({
|
||||
transportType: stage.transportType,
|
||||
distanceKm: stage.distanceKm,
|
||||
travelTimeSeconds: stage.travelTimeSeconds,
|
||||
fromName: stage.fromName
|
||||
transportType: stage.transport_type,
|
||||
distanceKm: stage.distance_km,
|
||||
travelTimeSeconds: stage.travel_time_seconds,
|
||||
fromName: stage.from_name
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user