Slackbot
12/06/2023, 9:26 PMZac Evans
12/06/2023, 9:28 PMHarpreet Sangar
12/07/2023, 9:23 AMZac Evans
12/07/2023, 9:54 PMZac Evans
12/07/2023, 10:01 PMexport const PRODUCT_SCHEMA = {
name: 'products',
fields: [
{ name: 'id', type: 'string' },
{ name: 'title', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'image', type: 'string' },
{ name: 'vendor', type: 'string', facet: true },
{ name: 'group', type: 'string', facet: true, optional: true },
// Handles
{ name: 'handle', type: 'string' },
{ name: 'handle.vendor', type: 'string' },
{ name: 'handle.category', type: 'string' },
// Categories
{ name: 'categories', type: 'string[]', facet: true },
{ name: 'categories.lvl0', type: 'string', facet: true, optional: true },
{ name: 'categories.lvl1', type: 'string', facet: true, optional: true },
{ name: 'categories.lvl2', type: 'string', facet: true, optional: true },
{ name: 'categories.lvl3', type: 'string', facet: true, optional: true },
{ name: 'categories.lvl4', type: 'string', facet: true, optional: true },
// Relationships
{ name: 'skus', type: 'string[]' }, // Double up on variants until query_by available on joins
{ name: 'riders', type: 'string[]', facet: true },
{ name: 'ride_types', type: 'string[]', facet: true },
{ name: 'availability', type: 'string[]', facet: true },
// Options
{ name: 'option_keys', type: 'string[]' },
// Pricing
{ name: 'price.from', type: 'float', facet: true },
{ name: 'price.to', type: 'float' },
],
token_separators: [ '-' ],
};
export const PRODUCT_VARIANT_SCHEMA = {
name: 'product_variants',
enable_nested_fields: true,
fields: [
{ name: 'id', type: 'string' },
{ name: 'title', type: 'string' },
{ name: 'image', type: 'string' },
{ name: 'skus', type: 'string[]' },
// Relationships
{ name: 'product_id', type: 'string', reference: 'products.id', facet: true },
{ name: 'vehicle_id', type: 'string[]', reference: 'vehicles.id', facet: true },
// Options
{ name: 'options.*', type: 'string', facet: true },
{ name: 'price', type: 'float', facet: true },
],
};
export const VEHICLE_SCHEMA = {
name: 'vehicles',
fields: [
{ name: 'id', type: 'string' },
{ name: 'title', type: 'string' },
{ name: 'handle', type: 'string' },
{ name: 'handle.vendor', type: 'string' },
{ name: 'vendor', type: 'string', facet: true },
{ name: 'model', type: 'string', facet: true },
{ name: 'year', type: 'int32', facet: true, sort: true },
{ name: 'image', type: 'string', optional: true },
{ name: 'popularity', type: 'int32' },
],
default_sorting_field: 'year',
};
export const RETAILER_SCHEMA = {
name: 'retailers',
fields: [
{ name: 'id', type: 'string' },
{ name: 'title', type: 'string' },
{ name: 'handle', type: 'string' },
{ name: 'image', type: 'string', index: false, optional: true },
{ name: 'address', type: 'string', index: false, optional: true },
{ name: 'location', type: 'geopoint' },
],
};
export const INVENTORY_SCHEMA = {
name: 'inventory',
fields: [
{ name: 'id', type: 'string' },
{ name: 'retailer_id', type: 'string', reference: 'retailers.id', facet: true },
{ name: 'product_variant_id', type: 'string', reference: 'product_variants.id', facet: true },
{ name: 'qty', type: 'int32' },
{ name: 'sku_src', type: 'string' },
],
default_sorting_field: 'qty',
};Zac Evans
12/07/2023, 10:27 PM// PRODUCT
{
"id": "f68b253d-0b82-5c82-86dd-9a6754236c9c",
"title": "Piston Kit",
"handle": "skf-fork-seal-kit",
"handle.category": "fork-seals",
"handle.vendor": "skf",
"image": "https://...",
"description": "...",
"categories": [
"Parts & Accessories",
"Bike Parts",
"Suspension",
"Fork & Components",
"Fork Seals"
],
"categories.lvl0": "Parts & Accessories",
"categories.lvl1": "Parts & Accessories > Bike Parts",
"categories.lvl2": "Parts & Accessories > Bike Parts > Suspension",
"categories.lvl3": "Parts & Accessories > Bike Parts > Suspension > Fork & Components",
"categories.lvl4": "Parts & Accessories > Bike Parts > Suspension > Fork & Components > Fork Seals",
"option_keys": [
"Size",
"Fitment"
],
"price.from": 46.95,
"price.to": 181.95,
"ride_types": [
"Off-Road",
"MX"
],
"riders": [],
"vendor": "Namura Technologies",
"availability": [
"Delivery"
]
}
// PRODUCT_VARIANT
{
"id": "c141f616-c4d1-5821-8178-db3574f7085a",
"title": "WP 48mm / 5627816",
"image": "https://...",
"options": {
"Fitment": "5627816",
"Option": "WP 48mm"
},
"price": 181.95,
"skus": [ "KITG48W", "1150485" ],
"product_id": "f68b253d-0b82-5c82-86dd-9a6754236c9c",
"vehicle_id": [ "23873", "25958", "22895" ]
}
// INVENTORY
{
"id": "78a5742d-f98c-592f-a2d0-0e74ccd08f7c",
"product_variant_id": "c141f616-c4d1-5821-8178-db3574f7085a",
"qty": 2,
"retailer_id": "abdd3ccb-71e6-57cd-96fe-75a9c687a7f9",
"sku_src": "115-0485"
}
// RETAILER
{
"address": "...",
"handle": "beverly-hills-ducati",
"id": "abdd3ccb-71e6-57cd-96fe-75a9c687a7f9",
"location": [ 34.0788905, -118.3763705 ],
"title": "Beverly Hills Ducati"
}Zac Evans
12/07/2023, 10:31 PMproducts collection, but filtering by what product_variants are in inventory at retailers within a location.Zac Evans
12/15/2023, 2:19 AMHarpreet Sangar
12/15/2023, 5:13 AMZac Evans
12/21/2023, 6:39 PMHarpreet Sangar
12/22/2023, 4:02 AMfilter_by because of how filtering is implemented. I'm working on adding support for the rest of the search parameters like include_fields.Harpreet Sangar
01/04/2024, 8:13 AMHarpreet Sangar
01/04/2024, 8:15 AMfilter_by, include_fields, and exclude_fields have support for nested join at the moment.
{ ... "include_fields": "$product_variants(id,$inventory(qty,sku,$retailer(id,title)))" }
This will work now.Zac Evans
01/04/2024, 9:13 AM