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:
@@ -78,15 +78,15 @@
|
||||
@click="onSelectOffer(offer)"
|
||||
>
|
||||
<OfferResultCard
|
||||
:supplier-name="offer.supplier_name"
|
||||
:supplier-name="offer.supplierName"
|
||||
:location-name="offer.country || ''"
|
||||
:product-name="offer.product_name"
|
||||
:price-per-unit="offer.price_per_unit ? Number(offer.price_per_unit) : null"
|
||||
:product-name="offer.productName"
|
||||
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
|
||||
:quantity="offer.quantity"
|
||||
:currency="offer.currency"
|
||||
:unit="offer.unit"
|
||||
:stages="getOfferStages(offer)"
|
||||
:total-time-seconds="offer.routes?.[0]?.total_time_seconds ?? null"
|
||||
:total-time-seconds="offer.routes?.[0]?.totalTimeSeconds ?? null"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -107,7 +107,7 @@
|
||||
<script setup lang="ts">
|
||||
import { GetNodeDocument, NearestOffersDocument, type NearestOffersQueryResult } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
type NearestOffer = NonNullable<NearestOffersQueryResult['nearest_offers'][number]>
|
||||
type NearestOffer = NonNullable<NearestOffersQueryResult['nearestOffers'][number]>
|
||||
|
||||
definePageMeta({ layout: 'topnav' })
|
||||
|
||||
@@ -151,7 +151,7 @@ const relatedPoints = computed(() => {
|
||||
.forEach(o => {
|
||||
points.push({
|
||||
uuid: o.uuid,
|
||||
name: o.product_name || '',
|
||||
name: o.productName || '',
|
||||
latitude: Number(o.latitude),
|
||||
longitude: Number(o.longitude),
|
||||
type: 'offer',
|
||||
@@ -167,7 +167,7 @@ const onMapSelect = (uuid: string) => {
|
||||
}
|
||||
|
||||
const onSelectOffer = (offer: NearestOffer) => {
|
||||
const productUuid = offer.product_uuid || offer.productUuid
|
||||
const productUuid = offer.productUuid
|
||||
if (offer.uuid && productUuid) {
|
||||
router.push(localePath(`/catalog/offers/${productUuid}?offer=${offer.uuid}`))
|
||||
}
|
||||
@@ -179,10 +179,10 @@ const getOfferStages = (offer: NearestOffer) => {
|
||||
return r.stages
|
||||
.filter((s): s is NonNullable<typeof s> => s !== null)
|
||||
.map(s => ({
|
||||
transportType: s.transport_type,
|
||||
distanceKm: s.distance_km,
|
||||
travelTimeSeconds: s.travel_time_seconds,
|
||||
fromName: s.from_name,
|
||||
transportType: s.transportType,
|
||||
distanceKm: s.distanceKm,
|
||||
travelTimeSeconds: s.travelTimeSeconds,
|
||||
fromName: s.fromName,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ const searchOffers = async () => {
|
||||
'geo'
|
||||
)
|
||||
|
||||
offers.value = (data?.nearest_offers || []).filter((o): o is NearestOffer => o !== null)
|
||||
offers.value = (data?.nearestOffers || []).filter((o): o is NearestOffer => o !== null)
|
||||
} finally {
|
||||
offersLoading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user