feat(catalog): add bounds filtering to list queries
Some checks failed
Build Docker Image / build (push) Has been cancelled
Some checks failed
Build Docker Image / build (push) Has been cancelled
- Add west/south/east/north params to HubsList, SuppliersList, ProductsList GraphQL - Update useCatalogHubs to pass bounds to query - Update useCatalogSuppliers to pass bounds to query - Update useCatalogProducts to pass bounds to query
This commit is contained in:
@@ -84,7 +84,13 @@ export function useCatalogHubs() {
|
|||||||
limit: PAGE_SIZE,
|
limit: PAGE_SIZE,
|
||||||
offset,
|
offset,
|
||||||
transportType,
|
transportType,
|
||||||
country
|
country,
|
||||||
|
...(filterBounds.value && {
|
||||||
|
west: filterBounds.value.west,
|
||||||
|
south: filterBounds.value.south,
|
||||||
|
east: filterBounds.value.east,
|
||||||
|
north: filterBounds.value.north
|
||||||
|
})
|
||||||
},
|
},
|
||||||
'public',
|
'public',
|
||||||
'geo'
|
'geo'
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const isInitialized = ref(false)
|
|||||||
// Filter state
|
// Filter state
|
||||||
const filterSupplierUuid = ref<string | null>(null)
|
const filterSupplierUuid = ref<string | null>(null)
|
||||||
const filterHubUuid = ref<string | null>(null)
|
const filterHubUuid = ref<string | null>(null)
|
||||||
|
const filterBounds = ref<{ west: number; south: number; east: number; north: number } | null>(null)
|
||||||
|
|
||||||
export function useCatalogProducts() {
|
export function useCatalogProducts() {
|
||||||
const { execute } = useGraphQL()
|
const { execute } = useGraphQL()
|
||||||
@@ -117,7 +118,15 @@ export function useCatalogProducts() {
|
|||||||
// All products from graph
|
// All products from graph
|
||||||
data = await execute(
|
data = await execute(
|
||||||
ProductsListDocument,
|
ProductsListDocument,
|
||||||
{ limit: 500 },
|
{
|
||||||
|
limit: 500,
|
||||||
|
...(filterBounds.value && {
|
||||||
|
west: filterBounds.value.west,
|
||||||
|
south: filterBounds.value.south,
|
||||||
|
east: filterBounds.value.east,
|
||||||
|
north: filterBounds.value.north
|
||||||
|
})
|
||||||
|
},
|
||||||
'public',
|
'public',
|
||||||
'geo'
|
'geo'
|
||||||
)
|
)
|
||||||
@@ -168,11 +177,12 @@ export function useCatalogProducts() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Products don't have coordinates directly (they're an aggregation of offers)
|
// Products are filtered by offer locations within bounds
|
||||||
// Bounds filtering would require a new backend query that filters by offer locations
|
const setBoundsFilter = (bounds: { west: number; south: number; east: number; north: number } | null) => {
|
||||||
// For now, this is a no-op - products show all regardless of map bounds
|
filterBounds.value = bounds
|
||||||
const setBoundsFilter = (_bounds: { west: number; south: number; east: number; north: number } | null) => {
|
if (isInitialized.value) {
|
||||||
// No-op: products are not filterable by map bounds in current implementation
|
fetchProducts()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -47,7 +47,16 @@ export function useCatalogSuppliers() {
|
|||||||
// Default: fetch all suppliers from GEO (graph-based)
|
// Default: fetch all suppliers from GEO (graph-based)
|
||||||
const data = await execute(
|
const data = await execute(
|
||||||
SuppliersListDocument,
|
SuppliersListDocument,
|
||||||
{ limit: PAGE_SIZE, offset },
|
{
|
||||||
|
limit: PAGE_SIZE,
|
||||||
|
offset,
|
||||||
|
...(filterBounds.value && {
|
||||||
|
west: filterBounds.value.west,
|
||||||
|
south: filterBounds.value.south,
|
||||||
|
east: filterBounds.value.east,
|
||||||
|
north: filterBounds.value.north
|
||||||
|
})
|
||||||
|
},
|
||||||
'public',
|
'public',
|
||||||
'geo'
|
'geo'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
query HubsList($limit: Int, $offset: Int, $country: String, $transportType: String) {
|
query HubsList($limit: Int, $offset: Int, $country: String, $transportType: String, $west: Float, $south: Float, $east: Float, $north: Float) {
|
||||||
hubsList(limit: $limit, offset: $offset, country: $country, transportType: $transportType) {
|
hubsList(limit: $limit, offset: $offset, country: $country, transportType: $transportType, west: $west, south: $south, east: $east, north: $north) {
|
||||||
uuid
|
uuid
|
||||||
name
|
name
|
||||||
latitude
|
latitude
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
query ProductsList($limit: Int, $offset: Int) {
|
query ProductsList($limit: Int, $offset: Int, $west: Float, $south: Float, $east: Float, $north: Float) {
|
||||||
productsList(limit: $limit, offset: $offset) {
|
productsList(limit: $limit, offset: $offset, west: $west, south: $south, east: $east, north: $north) {
|
||||||
uuid
|
uuid
|
||||||
name
|
name
|
||||||
offersCount
|
offersCount
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
query SuppliersList($limit: Int, $offset: Int, $country: String) {
|
query SuppliersList($limit: Int, $offset: Int, $country: String, $west: Float, $south: Float, $east: Float, $north: Float) {
|
||||||
suppliersList(limit: $limit, offset: $offset, country: $country) {
|
suppliersList(limit: $limit, offset: $offset, country: $country, west: $west, south: $south, east: $east, north: $north) {
|
||||||
uuid
|
uuid
|
||||||
name
|
name
|
||||||
latitude
|
latitude
|
||||||
|
|||||||
Reference in New Issue
Block a user