fix: migrate geo GraphQL queries and frontend to camelCase
All checks were successful
Build Docker Image / build (push) Successful in 5m0s
All checks were successful
Build Docker Image / build (push) Successful in 5m0s
Geo backend was migrated to camelCase but frontend .graphql files and component code still used snake_case, causing 400 errors on all geo API calls.
This commit is contained in:
@@ -95,7 +95,7 @@ import { GetOffersDocument, type GetOffersQueryVariables } from '~/composables/g
|
||||
import { GetNodeDocument, NearestOffersDocument, type NearestOffersQueryResult } from '~/composables/graphql/public/geo-generated'
|
||||
import type { MapBounds } from '~/components/catalog/CatalogMap.vue'
|
||||
|
||||
type NearestOffer = NonNullable<NearestOffersQueryResult['nearest_offers'][number]>
|
||||
type NearestOffer = NonNullable<NearestOffersQueryResult['nearestOffers'][number]>
|
||||
|
||||
definePageMeta({
|
||||
layout: 'topnav'
|
||||
@@ -433,7 +433,7 @@ const searchOfferPoints = computed(() =>
|
||||
.filter((offer) => offer.latitude != null && offer.longitude != null)
|
||||
.map((offer) => ({
|
||||
uuid: offer.uuid,
|
||||
name: offer.product_name || '',
|
||||
name: offer.productName || '',
|
||||
latitude: Number(offer.latitude),
|
||||
longitude: Number(offer.longitude),
|
||||
type: 'offer' as const
|
||||
@@ -548,7 +548,7 @@ const loadExploreOffers = async () => {
|
||||
'public',
|
||||
'geo'
|
||||
)
|
||||
exploreOffers.value = (geoData?.nearest_offers || []).filter((o): o is NearestOffer => o !== null)
|
||||
exploreOffers.value = (geoData?.nearestOffers || []).filter((o): o is NearestOffer => o !== null)
|
||||
} finally {
|
||||
exploreOffersLoading.value = false
|
||||
}
|
||||
@@ -570,7 +570,7 @@ const mapItems = computed((): MapItemWithCoords[] => {
|
||||
.filter((offer) => offer.uuid && offer.latitude != null && offer.longitude != null)
|
||||
.map((offer) => ({
|
||||
uuid: offer.uuid,
|
||||
name: offer.product_name || '',
|
||||
name: offer.productName || '',
|
||||
latitude: Number(offer.latitude),
|
||||
longitude: Number(offer.longitude)
|
||||
}))
|
||||
@@ -718,17 +718,17 @@ const onSearch = async () => {
|
||||
'geo'
|
||||
)
|
||||
|
||||
let nearest = (geoData?.nearest_offers || []).filter((o): o is NearestOffer => o !== null)
|
||||
let nearest = (geoData?.nearestOffers || []).filter((o): o is NearestOffer => o !== null)
|
||||
if (supplierId.value) {
|
||||
nearest = nearest.filter(o => o?.supplier_uuid === supplierId.value)
|
||||
nearest = nearest.filter(o => o?.supplierUuid === supplierId.value)
|
||||
}
|
||||
|
||||
offers.value = nearest
|
||||
quoteCalculations.value = buildCalculationsFromOffers(nearest)
|
||||
|
||||
const first = offers.value[0]
|
||||
if (first?.product_name) {
|
||||
setLabel('product', productId.value, first.product_name)
|
||||
if (first?.productName) {
|
||||
setLabel('product', productId.value, first.productName)
|
||||
}
|
||||
} else {
|
||||
offers.value = []
|
||||
@@ -774,8 +774,8 @@ const onSearch = async () => {
|
||||
}
|
||||
|
||||
// Select offer - navigate to detail page
|
||||
const onSelectOffer = (offer: { uuid: string; product_uuid?: string | null; productUuid?: string | null }) => {
|
||||
const productUuid = offer.product_uuid || offer.productUuid
|
||||
const onSelectOffer = (offer: { uuid: string; productUuid?: string | null }) => {
|
||||
const productUuid = offer.productUuid
|
||||
if (offer.uuid && productUuid) {
|
||||
router.push(localePath(`/catalog/offers/${productUuid}?offer=${offer.uuid}`))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user