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
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<script setup lang="ts">
|
||||
import { HubsListDocument, type HubsListQueryResult } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
type HubItem = NonNullable<NonNullable<HubsListQueryResult['hubsList']>[number]>
|
||||
type HubItem = NonNullable<NonNullable<HubsListQueryResult['hubs_list']>[number]>
|
||||
type HubWithDistance = HubItem & { distance?: string }
|
||||
|
||||
interface TeamAddress {
|
||||
@@ -96,7 +96,7 @@ const calculateDistance = (lat: number, lng: number) => {
|
||||
// Load logistics hubs
|
||||
const { data: locationsDataRaw, pending, error, refresh } = await useServerQuery('locations', HubsListDocument, { limit: 100 }, 'public', 'geo')
|
||||
const locationsData = computed<HubWithDistance[]>(() => {
|
||||
return (locationsDataRaw.value?.hubsList || [])
|
||||
return (locationsDataRaw.value?.hubs_list || [])
|
||||
.filter((location): location is HubItem => location !== null)
|
||||
.map((location) => ({
|
||||
...location,
|
||||
|
||||
@@ -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!]
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
@@ -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!]
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
@@ -113,7 +113,7 @@ const fetchRouteGeometry = async (stage: RouteStage): Promise<[number, number][]
|
||||
if (stage.transportType === 'auto' || stage.transportType === 'rail') {
|
||||
try {
|
||||
const RouteDocument = stage.transportType === 'auto' ? GetAutoRouteDocument : GetRailRouteDocument
|
||||
const routeField = stage.transportType === 'auto' ? 'autoRoute' : 'railRoute'
|
||||
const routeField = stage.transportType === 'auto' ? 'auto_route' : 'rail_route'
|
||||
|
||||
const routeData = await execute(RouteDocument, {
|
||||
fromLat: stage.fromLat,
|
||||
|
||||
@@ -182,7 +182,7 @@ const fetchStageGeometry = async (stage: RouteStage, routeIndex: number, stageIn
|
||||
if (stage.transportType === 'auto' || stage.transportType === 'rail') {
|
||||
try {
|
||||
const RouteDocument = stage.transportType === 'auto' ? GetAutoRouteDocument : GetRailRouteDocument
|
||||
const routeField = stage.transportType === 'auto' ? 'autoRoute' : 'railRoute'
|
||||
const routeField = stage.transportType === 'auto' ? 'auto_route' : 'rail_route'
|
||||
|
||||
const routeData = await execute(RouteDocument, { fromLat, fromLon, toLat, toLon }, 'public', 'geo') as Record<string, any>
|
||||
const geometry = routeData?.[routeField]?.geometry
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { Map as MapboxMapType } from 'mapbox-gl'
|
||||
import { LngLatBounds } from 'mapbox-gl'
|
||||
import type { ClusterPointType } from '~/composables/graphql/public/geo-generated'
|
||||
import type { ClusterPoint } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
interface MapItem {
|
||||
uuid?: string | null
|
||||
@@ -43,8 +43,8 @@ interface HoveredItem {
|
||||
const props = withDefaults(defineProps<{
|
||||
mapId: string
|
||||
items?: MapItem[]
|
||||
clusteredPoints?: ClusterPointType[]
|
||||
clusteredPointsByType?: Partial<Record<'offer' | 'hub' | 'supplier', ClusterPointType[]>>
|
||||
clusteredPoints?: ClusterPoint[]
|
||||
clusteredPointsByType?: Partial<Record<'offer' | 'hub' | 'supplier', ClusterPoint[]>>
|
||||
useServerClustering?: boolean
|
||||
hoveredItemId?: string | null
|
||||
hoveredItem?: HoveredItem | null
|
||||
@@ -227,7 +227,7 @@ const serverClusteredGeoJson = computed(() => ({
|
||||
id: point!.id,
|
||||
name: point!.name,
|
||||
count: point!.count ?? 1,
|
||||
expansionZoom: point!.expansionZoom,
|
||||
expansionZoom: point!.expansion_zoom,
|
||||
isCluster: (point!.count ?? 1) > 1
|
||||
},
|
||||
geometry: {
|
||||
@@ -238,7 +238,7 @@ const serverClusteredGeoJson = computed(() => ({
|
||||
}))
|
||||
|
||||
const serverClusteredGeoJsonByType = computed(() => {
|
||||
const build = (points: ClusterPointType[] | undefined, type: 'offer' | 'hub' | 'supplier') => ({
|
||||
const build = (points: ClusterPoint[] | undefined, type: 'offer' | 'hub' | 'supplier') => ({
|
||||
type: 'FeatureCollection' as const,
|
||||
features: (points || []).filter(Boolean).map(point => ({
|
||||
type: 'Feature' as const,
|
||||
@@ -246,7 +246,7 @@ const serverClusteredGeoJsonByType = computed(() => {
|
||||
id: point!.id,
|
||||
name: point!.name,
|
||||
count: point!.count ?? 1,
|
||||
expansionZoom: point!.expansionZoom,
|
||||
expansionZoom: point!.expansion_zoom,
|
||||
isCluster: (point!.count ?? 1) > 1,
|
||||
type
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</Text>
|
||||
</div>
|
||||
<!-- Transport icons bottom -->
|
||||
<div v-if="hub.transportTypes?.length" class="flex items-center gap-1 pt-1">
|
||||
<div v-if="hub.transport_types?.length" class="flex items-center gap-1 pt-1">
|
||||
<Icon v-if="hasTransport('auto')" name="lucide:truck" size="14" class="text-base-content/50" />
|
||||
<Icon v-if="hasTransport('rail')" name="lucide:train-front" size="14" class="text-base-content/50" />
|
||||
<Icon v-if="hasTransport('sea')" name="lucide:ship" size="14" class="text-base-content/50" />
|
||||
@@ -58,12 +58,12 @@ interface Hub {
|
||||
uuid?: string | null
|
||||
name?: string | null
|
||||
country?: string | null
|
||||
countryCode?: string | null
|
||||
country_code?: string | null
|
||||
latitude?: number | null
|
||||
longitude?: number | null
|
||||
distance?: string
|
||||
distanceKm?: number | null
|
||||
transportTypes?: (string | null)[] | null
|
||||
distance_km?: number | null
|
||||
transport_types?: (string | null)[] | null
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -91,16 +91,16 @@ const isoToEmoji = (code: string): string => {
|
||||
}
|
||||
|
||||
const countryFlag = computed(() => {
|
||||
if (props.hub.countryCode) {
|
||||
return isoToEmoji(props.hub.countryCode)
|
||||
if (props.hub.country_code) {
|
||||
return isoToEmoji(props.hub.country_code)
|
||||
}
|
||||
return '🌍'
|
||||
})
|
||||
|
||||
const hasTransport = (type: string) => props.hub.transportTypes?.some(t => t === type)
|
||||
const hasTransport = (type: string) => props.hub.transport_types?.some(t => t === type)
|
||||
const distanceLabel = computed(() => {
|
||||
if (props.hub.distance) return props.hub.distance
|
||||
if (props.hub.distanceKm != null) return `${Math.round(props.hub.distanceKm)} km`
|
||||
if (props.hub.distance_km != null) return `${Math.round(props.hub.distance_km)} km`
|
||||
return ''
|
||||
})
|
||||
|
||||
|
||||
@@ -172,14 +172,14 @@
|
||||
v-for="(offer, index) in offersWithPrice"
|
||||
:key="offer.uuid ?? index"
|
||||
:supplier-name="getOfferSupplierName(offer)"
|
||||
:location-name="offer.locationName || offer.locationCountry || offer.country || offer.locationName"
|
||||
:product-name="offer.productName"
|
||||
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
|
||||
:location-name="offer.country || ''"
|
||||
:product-name="offer.product_name"
|
||||
:price-per-unit="offer.price_per_unit ? Number(offer.price_per_unit) : null"
|
||||
:quantity="offer.quantity"
|
||||
:currency="offer.currency"
|
||||
:unit="offer.unit"
|
||||
:stages="getOfferStages(offer)"
|
||||
:total-time-seconds="offer.routes?.[0]?.totalTimeSeconds ?? null"
|
||||
:total-time-seconds="offer.routes?.[0]?.total_time_seconds ?? null"
|
||||
@select="onOfferSelect(offer)"
|
||||
/>
|
||||
</div>
|
||||
@@ -315,7 +315,7 @@ import type {
|
||||
InfoSupplierItem,
|
||||
InfoOfferItem
|
||||
} from '~/composables/useCatalogInfo'
|
||||
import type { RouteStageType } from '~/composables/graphql/public/geo-generated'
|
||||
import type { RouteStage } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
const props = defineProps<{
|
||||
entityType: InfoEntityType
|
||||
@@ -353,7 +353,7 @@ const relatedHubs = computed(() => props.relatedHubs ?? [])
|
||||
const relatedSuppliers = computed(() => props.relatedSuppliers ?? [])
|
||||
const relatedOffers = computed(() => props.relatedOffers ?? [])
|
||||
const offersWithPrice = computed(() =>
|
||||
relatedOffers.value.filter(o => o?.pricePerUnit != null)
|
||||
relatedOffers.value.filter(o => o?.price_per_unit != null)
|
||||
)
|
||||
|
||||
const suppliersByUuid = computed(() => {
|
||||
@@ -370,9 +370,9 @@ const suppliersByUuid = computed(() => {
|
||||
})
|
||||
|
||||
const getOfferSupplierName = (offer: InfoOfferItem) => {
|
||||
if (offer.supplierName) return offer.supplierName
|
||||
if (offer.supplierUuid && suppliersByUuid.value.has(offer.supplierUuid)) {
|
||||
return suppliersByUuid.value.get(offer.supplierUuid)
|
||||
if (offer.supplier_name) return offer.supplier_name
|
||||
if (offer.supplier_uuid && suppliersByUuid.value.has(offer.supplier_uuid)) {
|
||||
return suppliersByUuid.value.get(offer.supplier_uuid)
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -441,11 +441,11 @@ const formatPrice = (price: number | string) => {
|
||||
}
|
||||
|
||||
const railHubs = computed(() =>
|
||||
relatedHubs.value.filter(h => h.transportTypes?.includes('rail'))
|
||||
relatedHubs.value.filter(h => h.transport_types?.includes('rail'))
|
||||
)
|
||||
|
||||
const seaHubs = computed(() =>
|
||||
relatedHubs.value.filter(h => h.transportTypes?.includes('sea'))
|
||||
relatedHubs.value.filter(h => h.transport_types?.includes('sea'))
|
||||
)
|
||||
|
||||
// Mock KYC teaser data (will be replaced with real data later)
|
||||
@@ -473,7 +473,7 @@ const onProductSelect = (product: InfoProductItem) => {
|
||||
|
||||
const onOfferSelect = (offer: InfoOfferItem) => {
|
||||
if (offer.uuid) {
|
||||
emit('select-offer', { uuid: offer.uuid, productUuid: offer.productUuid })
|
||||
emit('select-offer', { uuid: offer.uuid, productUuid: offer.product_uuid })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,12 +493,12 @@ const getOfferStages = (offer: InfoOfferItem) => {
|
||||
const route = offer.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
|
||||
}))
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
>
|
||||
<OfferResultCard
|
||||
grouped
|
||||
:supplier-name="offer.supplierName"
|
||||
:location-name="offer.locationName || offer.locationCountry"
|
||||
:product-name="offer.productName"
|
||||
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
|
||||
:supplier-name="offer.supplier_name"
|
||||
:location-name="offer.country || ''"
|
||||
:product-name="offer.product_name"
|
||||
:price-per-unit="offer.price_per_unit ? Number(offer.price_per_unit) : null"
|
||||
:quantity="offer.quantity"
|
||||
:currency="offer.currency"
|
||||
:unit="offer.unit"
|
||||
:stages="getOfferStages(offer)"
|
||||
:total-time-seconds="offer.routes?.[0]?.totalTimeSeconds ?? null"
|
||||
:total-time-seconds="offer.routes?.[0]?.total_time_seconds ?? null"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,15 +58,15 @@
|
||||
@click="emit('select-offer', offer)"
|
||||
>
|
||||
<OfferResultCard
|
||||
:supplier-name="offer.supplierName"
|
||||
:location-name="offer.locationName || offer.locationCountry"
|
||||
:product-name="offer.productName"
|
||||
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
|
||||
:supplier-name="offer.supplier_name"
|
||||
:location-name="offer.country || ''"
|
||||
:product-name="offer.product_name"
|
||||
:price-per-unit="offer.price_per_unit ? Number(offer.price_per_unit) : null"
|
||||
:quantity="offer.quantity"
|
||||
:currency="offer.currency"
|
||||
:unit="offer.unit"
|
||||
:stages="getOfferStages(offer)"
|
||||
:total-time-seconds="offer.routes?.[0]?.totalTimeSeconds ?? null"
|
||||
:total-time-seconds="offer.routes?.[0]?.total_time_seconds ?? null"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,24 +78,23 @@
|
||||
<script setup lang="ts">
|
||||
interface Offer {
|
||||
uuid: string
|
||||
productName?: string | null
|
||||
productUuid?: string | null
|
||||
supplierName?: string | null
|
||||
supplierUuid?: string | null
|
||||
product_name?: string | null
|
||||
product_uuid?: string | null
|
||||
supplier_name?: string | null
|
||||
supplier_uuid?: string | null
|
||||
quantity?: number | string | null
|
||||
unit?: string | null
|
||||
pricePerUnit?: number | string | null
|
||||
price_per_unit?: number | string | null
|
||||
currency?: string | null
|
||||
locationName?: string | null
|
||||
locationCountry?: string | null
|
||||
locationCountryCode?: string | null
|
||||
country?: string | null
|
||||
country_code?: string | null
|
||||
routes?: Array<{
|
||||
totalTimeSeconds?: number | null
|
||||
total_time_seconds?: number | null
|
||||
stages?: Array<{
|
||||
transportType?: string | null
|
||||
distanceKm?: number | null
|
||||
travelTimeSeconds?: number | null
|
||||
fromName?: string | null
|
||||
transport_type?: string | null
|
||||
distance_km?: number | null
|
||||
travel_time_seconds?: number | null
|
||||
from_name?: string | null
|
||||
} | null> | null
|
||||
} | null> | null
|
||||
}
|
||||
@@ -116,7 +115,7 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
const offersWithPrice = computed(() =>
|
||||
(props.offers || []).filter(o => o?.pricePerUnit != null)
|
||||
(props.offers || []).filter(o => o?.price_per_unit != null)
|
||||
)
|
||||
|
||||
const totalOffers = computed(() => {
|
||||
@@ -140,10 +139,10 @@ const getOfferStages = (offer: Offer) => {
|
||||
return route.stages
|
||||
.filter((stage): stage is NonNullable<typeof stage> => 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
|
||||
}))
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -336,15 +336,12 @@ const clusterSupplierUuid = computed(() => props.clusterSupplierUuid ?? undefine
|
||||
const { clusteredNodes, fetchClusters, loading: singleClusterLoading, clearNodes } = useClusteredNodes(
|
||||
undefined,
|
||||
activeClusterNodeType,
|
||||
clusterProductUuid,
|
||||
clusterHubUuid,
|
||||
clusterSupplierUuid
|
||||
)
|
||||
|
||||
// Server-side clustering (typed mode)
|
||||
const offerClusters = useClusteredNodes(undefined, ref('offer'), clusterProductUuid, clusterHubUuid, clusterSupplierUuid)
|
||||
const hubClusters = useClusteredNodes(undefined, ref('logistics'), clusterProductUuid, clusterHubUuid, clusterSupplierUuid)
|
||||
const supplierClusters = useClusteredNodes(undefined, ref('supplier'), clusterProductUuid, clusterHubUuid, clusterSupplierUuid)
|
||||
const offerClusters = useClusteredNodes(undefined, ref('offer'))
|
||||
const hubClusters = useClusteredNodes(undefined, ref('logistics'))
|
||||
const supplierClusters = useClusteredNodes(undefined, ref('supplier'))
|
||||
|
||||
const clusteredPointsByType = computed(() => ({
|
||||
offer: offerClusters.clusteredNodes.value,
|
||||
|
||||
Reference in New Issue
Block a user