Use graph-based offers and remove radius filters
Some checks failed
Build Docker Image / build (push) Has been cancelled
Some checks failed
Build Docker Image / build (push) Has been cancelled
This commit is contained in:
@@ -15,7 +15,8 @@ import type {
|
||||
} from '~/composables/graphql/public/exchange-generated'
|
||||
import {
|
||||
GetOfferDocument,
|
||||
GetSupplierProfileDocument
|
||||
GetSupplierProfileDocument,
|
||||
GetSupplierOffersDocument
|
||||
} from '~/composables/graphql/public/exchange-generated'
|
||||
|
||||
// Types from codegen
|
||||
@@ -125,7 +126,8 @@ export function useCatalogInfo() {
|
||||
{
|
||||
lat: coords.lat,
|
||||
lon: coords.lon,
|
||||
radius: 500
|
||||
hubUuid: uuid,
|
||||
limit: 500
|
||||
},
|
||||
'public',
|
||||
'geo'
|
||||
@@ -224,21 +226,16 @@ export function useCatalogInfo() {
|
||||
isLoadingProducts.value = true
|
||||
isLoadingHubs.value = true
|
||||
|
||||
// Load products (offers grouped by product)
|
||||
// Load products from supplier offers (no geo radius)
|
||||
execute(
|
||||
NearestOffersDocument,
|
||||
{
|
||||
lat: entity.value.latitude,
|
||||
lon: entity.value.longitude,
|
||||
radius: 500
|
||||
},
|
||||
GetSupplierOffersDocument,
|
||||
{ teamUuid: uuid },
|
||||
'public',
|
||||
'geo'
|
||||
'exchange'
|
||||
).then(offersData => {
|
||||
// Group offers by product
|
||||
const productsMap = new Map<string, InfoProductItem>()
|
||||
offersData?.nearestOffers?.forEach(offer => {
|
||||
if (!offer || !offer.productUuid || !offer.productName) return
|
||||
offersData?.getOffers?.forEach(offer => {
|
||||
if (!offer?.productUuid || !offer.productName) return
|
||||
const existing = productsMap.get(offer.productUuid)
|
||||
if (existing) {
|
||||
existing.offersCount = (existing.offersCount || 0) + 1
|
||||
@@ -261,7 +258,6 @@ export function useCatalogInfo() {
|
||||
{
|
||||
lat: entity.value.latitude,
|
||||
lon: entity.value.longitude,
|
||||
radius: 1000,
|
||||
sourceUuid: entity.value.uuid,
|
||||
limit: 12
|
||||
},
|
||||
@@ -312,7 +308,6 @@ export function useCatalogInfo() {
|
||||
{
|
||||
lat: coords.lat,
|
||||
lon: coords.lon,
|
||||
radius: 1000,
|
||||
sourceUuid: entity.value?.uuid ?? null,
|
||||
limit: 12
|
||||
},
|
||||
@@ -372,7 +367,6 @@ export function useCatalogInfo() {
|
||||
lon: hub.longitude,
|
||||
productUuid,
|
||||
hubUuid, // Pass hubUuid to get routes calculated on backend
|
||||
radius: 500,
|
||||
limit: 12
|
||||
},
|
||||
'public',
|
||||
@@ -438,7 +432,6 @@ export function useCatalogInfo() {
|
||||
{
|
||||
lat: supplier.latitude,
|
||||
lon: supplier.longitude,
|
||||
radius: 1000,
|
||||
sourceUuid: supplier.uuid,
|
||||
limit: 1
|
||||
},
|
||||
@@ -462,14 +455,17 @@ export function useCatalogInfo() {
|
||||
lon: supplier.longitude,
|
||||
productUuid,
|
||||
...(hubUuid ? { hubUuid } : {}),
|
||||
radius: 500,
|
||||
limit: 12
|
||||
},
|
||||
'public',
|
||||
'geo'
|
||||
)
|
||||
|
||||
relatedOffers.value = (offersData?.nearestOffers || []).filter((o): o is OfferItem => o !== null)
|
||||
relatedOffers.value = (offersData?.nearestOffers || []).filter((o): o is OfferItem => {
|
||||
if (!o) return false
|
||||
if (!supplier.uuid) return true
|
||||
return o.supplierUuid === supplier.uuid
|
||||
})
|
||||
isLoadingOffers.value = false
|
||||
} finally {
|
||||
isLoadingOffers.value = false
|
||||
|
||||
Reference in New Issue
Block a user