vabatta
12/28/2021, 4:05 PMproducts
that has a many-to-many
relationship to categories
so that searchQuery
can be either an ilike of product.name OR ilike of category.name
but I cannot figure out why it doesn't work
ts
supabase()
.from<ProductWithIngredients>('products')
.select('*, ingredients(*), products_ingredients(*), categories(*)')
.or(`name.ilike.%${searchQuery}%`)
.or(`name.ilike.%${searchQuery}%`, { foreignTable: 'categories' })
.throwOnError()
.then((response) => (isNull(response.data) ? [] : response.data));
Any idea?Steve
12/29/2021, 12:03 PMcategories!inner
as:
js
supabase()
.from<ProductWithIngredients>('products')
.select('*, ingredients(*), products_ingredients(*), categories!inner(*)') .or(`name.ilike.%${searchQuery}%`)
.or(`name.ilike.%${searchQuery}%`, { foreignTable: 'categories' })
vabatta
12/30/2021, 11:20 AMvabatta
12/30/2021, 11:48 AMvabatta
12/30/2021, 11:49 AM