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:
@@ -39,8 +39,8 @@
|
||||
<Stack v-if="autoEdges.length > 0" gap="2">
|
||||
<NuxtLink
|
||||
v-for="(edge, index) in autoEdges"
|
||||
: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">
|
||||
@@ -49,11 +49,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>
|
||||
@@ -71,8 +71,8 @@
|
||||
<Stack v-if="railEdges.length > 0" gap="2">
|
||||
<NuxtLink
|
||||
v-for="(edge, index) in railEdges"
|
||||
: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">
|
||||
@@ -81,11 +81,11 @@
|
||||
<Icon name="lucide:map-pin" size="16" class="text-emerald-500" />
|
||||
</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-emerald-600">{{ edge.distanceKm }} km</div>
|
||||
<div class="font-semibold text-emerald-600">{{ edge.distance_km }} km</div>
|
||||
</div>
|
||||
</div>
|
||||
</NuxtLink>
|
||||
@@ -104,7 +104,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
|
||||
@@ -119,8 +119,8 @@ interface RouteGeometry {
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
autoEdges: EdgeType[]
|
||||
railEdges: EdgeType[]
|
||||
autoEdges: Edge[]
|
||||
railEdges: Edge[]
|
||||
hub: CurrentHub
|
||||
railHub: CurrentHub
|
||||
autoRouteGeometries: RouteGeometry[]
|
||||
@@ -147,8 +147,8 @@ const mapCenter = computed<[number, number]>(() => {
|
||||
|
||||
const allEdges = [...props.autoEdges, ...props.railEdges]
|
||||
allEdges.forEach((edge) => {
|
||||
if (edge.toLatitude && edge.toLongitude) {
|
||||
points.push([edge.toLongitude, edge.toLatitude])
|
||||
if (edge.to_latitude && edge.to_longitude) {
|
||||
points.push([edge.to_longitude, edge.to_latitude])
|
||||
}
|
||||
})
|
||||
|
||||
@@ -161,7 +161,7 @@ const mapCenter = computed<[number, number]>(() => {
|
||||
})
|
||||
|
||||
const mapZoom = computed(() => {
|
||||
const distances = [...props.autoEdges, ...props.railEdges].map(e => e.distanceKm || 0)
|
||||
const distances = [...props.autoEdges, ...props.railEdges].map(e => e.distance_km || 0)
|
||||
if (distances.length === 0) return 5
|
||||
|
||||
const maxDistance = Math.max(...distances)
|
||||
@@ -190,21 +190,21 @@ const buildRouteFeatureCollection = (routes: RouteGeometry[], transportType: 'au
|
||||
}))
|
||||
})
|
||||
|
||||
const buildNeighborsFeatureCollection = (edges: EdgeType[], transportType: 'auto' | 'rail') => ({
|
||||
const buildNeighborsFeatureCollection = (edges: Edge[], transportType: 'auto' | 'rail') => ({
|
||||
type: 'FeatureCollection' as const,
|
||||
features: edges
|
||||
.filter(e => e.toLatitude && e.toLongitude)
|
||||
.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,
|
||||
transportType
|
||||
},
|
||||
geometry: {
|
||||
type: 'Point' as const,
|
||||
coordinates: [edge.toLongitude!, edge.toLatitude!]
|
||||
coordinates: [edge.to_longitude!, edge.to_latitude!]
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user