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:
@@ -38,8 +38,8 @@
|
||||
<Stack gap="2">
|
||||
<NuxtLink
|
||||
v-for="(edge, index) in edges"
|
||||
:key="edge.toUuid ?? index"
|
||||
:to="localePath(`/catalog/hubs/${edge.toUuid}`)"
|
||||
:key="edge.to_uuid ?? index"
|
||||
:to="localePath(`/catalog/hubs/${edge.to_uuid}`)"
|
||||
class="flex flex-col gap-2 p-3 rounded-lg border border-base-300 hover:bg-base-200 transition-colors"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
@@ -48,11 +48,11 @@
|
||||
<Icon name="lucide:map-pin" size="16" class="text-primary" />
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-medium">{{ edge.toName }}</div>
|
||||
<div class="font-medium">{{ edge.to_name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<div class="font-semibold text-primary">{{ edge.distanceKm }} km</div>
|
||||
<div class="font-semibold text-primary">{{ edge.distance_km }} km</div>
|
||||
</div>
|
||||
</div>
|
||||
</NuxtLink>
|
||||
@@ -66,7 +66,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { Map as MapboxMapType } from 'mapbox-gl'
|
||||
import { LngLatBounds, Popup } from 'mapbox-gl'
|
||||
import type { EdgeType } from '~/composables/graphql/public/geo-generated'
|
||||
import type { Edge } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
interface CurrentHub {
|
||||
uuid: string
|
||||
@@ -81,7 +81,7 @@ interface RouteGeometry {
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
edges: EdgeType[]
|
||||
edges: Edge[]
|
||||
currentHub: CurrentHub
|
||||
routeGeometries: RouteGeometry[]
|
||||
transportType: 'auto' | 'rail'
|
||||
@@ -124,8 +124,8 @@ const mapCenter = computed<[number, number]>(() => {
|
||||
return [0, 0]
|
||||
}
|
||||
|
||||
const allLats = [props.currentHub.latitude, ...props.edges.map(e => e.toLatitude!).filter(Boolean)]
|
||||
const allLngs = [props.currentHub.longitude, ...props.edges.map(e => e.toLongitude!).filter(Boolean)]
|
||||
const allLats = [props.currentHub.latitude, ...props.edges.map(e => e.to_latitude!).filter(Boolean)]
|
||||
const allLngs = [props.currentHub.longitude, ...props.edges.map(e => e.to_longitude!).filter(Boolean)]
|
||||
|
||||
const avgLng = allLngs.reduce((a, b) => a + b, 0) / allLngs.length
|
||||
const avgLat = allLats.reduce((a, b) => a + b, 0) / allLats.length
|
||||
@@ -166,16 +166,16 @@ const buildRouteFeatureCollection = () => ({
|
||||
|
||||
const buildNeighborsFeatureCollection = () => ({
|
||||
type: 'FeatureCollection' as const,
|
||||
features: props.edges.filter(e => e.toLatitude && e.toLongitude).map(edge => ({
|
||||
features: props.edges.filter(e => e.to_latitude && e.to_longitude).map(edge => ({
|
||||
type: 'Feature' as const,
|
||||
properties: {
|
||||
uuid: edge.toUuid,
|
||||
name: edge.toName,
|
||||
distanceKm: edge.distanceKm
|
||||
uuid: edge.to_uuid,
|
||||
name: edge.to_name,
|
||||
distanceKm: edge.distance_km
|
||||
},
|
||||
geometry: {
|
||||
type: 'Point' as const,
|
||||
coordinates: [edge.toLongitude!, edge.toLatitude!]
|
||||
coordinates: [edge.to_longitude!, edge.to_latitude!]
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user