From 4d6a7d9f324cb43a8949c74f1f759b9232aa1d6b Mon Sep 17 00:00:00 2001 From: consultoria-as Date: Thu, 14 May 2026 21:38:36 +0000 Subject: [PATCH] fix(catalog): filter vehicle-brands to North America OEM brands only /vehicle-brands now uses get_brands_for_mode('oem') to return the same 36 North American brands (Mexico/USA/Canada) as the regular catalog flow, instead of all 619 brands in the database. --- pos/blueprints/catalog_bp.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pos/blueprints/catalog_bp.py b/pos/blueprints/catalog_bp.py index 61c0b50..8835809 100644 --- a/pos/blueprints/catalog_bp.py +++ b/pos/blueprints/catalog_bp.py @@ -598,19 +598,23 @@ def _match_vin_to_catalog(master_conn, vin_info): @catalog_bp.route('/vehicle-brands', methods=['GET']) @require_auth('catalog.view') def vehicle_brands(): - """Return vehicle brands for brand-first catalog browsing. + """Return North American vehicle brands for brand-first catalog browsing. - Returns all brands from the brands table (fast) rather than scanning - the 256M-row part_vehicle_preview materialized view. + Uses the same OEM_BRANDS_NA filter as the regular catalog so that + the brand list is consistent across both navigation modes. """ + from services.catalog_modes import get_brands_for_mode + allowed = list(get_brands_for_mode('oem')) + def _query(master): cur = master.cursor() try: cur.execute(""" SELECT id_brand, name_brand FROM brands + WHERE name_brand = ANY(%s) ORDER BY name_brand ASC - """) + """, (allowed,)) rows = cur.fetchall() return jsonify({ 'brands': [