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:
@@ -23,8 +23,8 @@ import {
|
||||
type NodeEntity = NonNullable<GetNodeQueryResult['node']>
|
||||
type OfferEntity = NonNullable<GetOfferQueryResult['getOffer']>
|
||||
type SupplierProfile = NonNullable<GetSupplierProfileQueryResult['getSupplierProfile']>
|
||||
type HubItem = NonNullable<NonNullable<NearestHubsQueryResult['nearest_hubs']>[number]>
|
||||
type OfferItem = NonNullable<NonNullable<NearestOffersQueryResult['nearest_offers']>[number]>
|
||||
type HubItem = NonNullable<NonNullable<NearestHubsQueryResult['nearestHubs']>[number]>
|
||||
type OfferItem = NonNullable<NonNullable<NearestOffersQueryResult['nearestOffers']>[number]>
|
||||
|
||||
// Product type (aggregated from offers)
|
||||
export interface InfoProductItem {
|
||||
@@ -136,27 +136,27 @@ export function useCatalogInfo() {
|
||||
const productsMap = new Map<string, InfoProductItem>()
|
||||
const suppliersMap = new Map<string, { uuid: string; name: string; latitude?: number | null; longitude?: number | null }>()
|
||||
|
||||
offersData?.nearest_offers?.forEach(offer => {
|
||||
offersData?.nearestOffers?.forEach(offer => {
|
||||
if (!offer) return
|
||||
// Products
|
||||
if (offer.product_uuid && offer.product_name) {
|
||||
const existing = productsMap.get(offer.product_uuid)
|
||||
if (offer.productUuid && offer.productName) {
|
||||
const existing = productsMap.get(offer.productUuid)
|
||||
if (existing) {
|
||||
existing.offersCount = (existing.offersCount || 0) + 1
|
||||
} else {
|
||||
productsMap.set(offer.product_uuid, {
|
||||
uuid: offer.product_uuid,
|
||||
name: offer.product_name,
|
||||
productsMap.set(offer.productUuid, {
|
||||
uuid: offer.productUuid,
|
||||
name: offer.productName,
|
||||
offersCount: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Suppliers (extract from offers)
|
||||
if (offer.supplier_uuid && !suppliersMap.has(offer.supplier_uuid)) {
|
||||
suppliersMap.set(offer.supplier_uuid, {
|
||||
uuid: offer.supplier_uuid,
|
||||
name: offer.supplier_name || 'Supplier',
|
||||
if (offer.supplierUuid && !suppliersMap.has(offer.supplierUuid)) {
|
||||
suppliersMap.set(offer.supplierUuid, {
|
||||
uuid: offer.supplierUuid,
|
||||
name: offer.supplierName || 'Supplier',
|
||||
latitude: offer.latitude,
|
||||
longitude: offer.longitude
|
||||
})
|
||||
@@ -264,7 +264,7 @@ export function useCatalogInfo() {
|
||||
'public',
|
||||
'geo'
|
||||
).then(hubsData => {
|
||||
relatedHubs.value = (hubsData?.nearest_hubs || []).filter((h): h is HubItem => h !== null)
|
||||
relatedHubs.value = (hubsData?.nearestHubs || []).filter((h): h is HubItem => h !== null)
|
||||
}).finally(() => {
|
||||
isLoadingHubs.value = false
|
||||
})
|
||||
@@ -314,7 +314,7 @@ export function useCatalogInfo() {
|
||||
'public',
|
||||
'geo'
|
||||
).then(hubsData => {
|
||||
relatedHubs.value = (hubsData?.nearest_hubs || []).filter((h): h is HubItem => h !== null)
|
||||
relatedHubs.value = (hubsData?.nearestHubs || []).filter((h): h is HubItem => h !== null)
|
||||
}).finally(() => {
|
||||
isLoadingHubs.value = false
|
||||
})
|
||||
@@ -374,14 +374,14 @@ export function useCatalogInfo() {
|
||||
)
|
||||
|
||||
// Offers already include routes from backend
|
||||
relatedOffers.value = (offersData?.nearest_offers || []).filter((o): o is OfferItem => o !== null)
|
||||
relatedOffers.value = (offersData?.nearestOffers || []).filter((o): o is OfferItem => o !== null)
|
||||
isLoadingOffers.value = false
|
||||
|
||||
// Extract unique suppliers from offers (use supplier_uuid from offers)
|
||||
// Extract unique suppliers from offers (use supplierUuid from offers)
|
||||
const supplierUuids = new Set<string>()
|
||||
relatedOffers.value.forEach(offer => {
|
||||
if (offer.supplier_uuid) {
|
||||
supplierUuids.add(offer.supplier_uuid)
|
||||
if (offer.supplierUuid) {
|
||||
supplierUuids.add(offer.supplierUuid)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -438,7 +438,7 @@ export function useCatalogInfo() {
|
||||
'public',
|
||||
'geo'
|
||||
)
|
||||
const hub = (hubsData?.nearest_hubs || []).find((h): h is HubItem => h !== null)
|
||||
const hub = (hubsData?.nearestHubs || []).find((h): h is HubItem => h !== null)
|
||||
if (hub?.uuid) {
|
||||
hubUuid = hub.uuid
|
||||
if (!relatedHubs.value.length) {
|
||||
@@ -461,10 +461,10 @@ export function useCatalogInfo() {
|
||||
'geo'
|
||||
)
|
||||
|
||||
relatedOffers.value = (offersData?.nearest_offers || []).filter((o): o is OfferItem => {
|
||||
relatedOffers.value = (offersData?.nearestOffers || []).filter((o): o is OfferItem => {
|
||||
if (!o) return false
|
||||
if (!supplier.uuid) return true
|
||||
return o.supplier_uuid === supplier.uuid
|
||||
return o.supplierUuid === supplier.uuid
|
||||
})
|
||||
isLoadingOffers.value = false
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user