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:
@@ -9,8 +9,8 @@ import {
|
||||
} from '~/composables/graphql/public/exchange-generated'
|
||||
|
||||
// Type from codegen
|
||||
type ProductItem = NonNullable<NonNullable<ProductsListQueryResult['productsList']>[number]>
|
||||
type OfferItem = NonNullable<NonNullable<NearestOffersQueryResult['nearestOffers']>[number]>
|
||||
type ProductItem = NonNullable<NonNullable<ProductsListQueryResult['products_list']>[number]>
|
||||
type OfferItem = NonNullable<NonNullable<NearestOffersQueryResult['nearest_offers']>[number]>
|
||||
|
||||
// Product aggregated from offers
|
||||
interface AggregatedProduct {
|
||||
@@ -92,16 +92,16 @@ export function useCatalogProducts() {
|
||||
|
||||
// Group offers by product
|
||||
const productsMap = new Map<string, AggregatedProduct>()
|
||||
offersData?.nearestOffers?.forEach((offer) => {
|
||||
if (!offer?.productUuid) return
|
||||
if (!productsMap.has(offer.productUuid)) {
|
||||
productsMap.set(offer.productUuid, {
|
||||
uuid: offer.productUuid,
|
||||
name: offer.productName,
|
||||
offersData?.nearest_offers?.forEach((offer) => {
|
||||
if (!offer?.product_uuid) return
|
||||
if (!productsMap.has(offer.product_uuid)) {
|
||||
productsMap.set(offer.product_uuid, {
|
||||
uuid: offer.product_uuid,
|
||||
name: offer.product_name,
|
||||
offersCount: 0
|
||||
})
|
||||
}
|
||||
productsMap.get(offer.productUuid)!.offersCount++
|
||||
productsMap.get(offer.product_uuid)!.offersCount++
|
||||
})
|
||||
items.value = Array.from(productsMap.values()) as ProductItem[]
|
||||
}
|
||||
@@ -121,7 +121,7 @@ export function useCatalogProducts() {
|
||||
'public',
|
||||
'geo'
|
||||
)
|
||||
items.value = (data?.productsList || []).filter((p): p is ProductItem => p !== null)
|
||||
items.value = (data?.products_list || []).filter((p): p is ProductItem => p !== null)
|
||||
}
|
||||
|
||||
isInitialized.value = true
|
||||
|
||||
Reference in New Issue
Block a user