feat: dropdown filtra marcas y modelos por ano seleccionado
Al seleccionar ano, solo muestra marcas/modelos disponibles para ese ano. Toyota 2020: 92 modelos vs 625 sin filtro. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,8 +62,9 @@ def _master_only(fn):
|
||||
@catalog_bp.route('/brands', methods=['GET'])
|
||||
@require_auth('catalog.view')
|
||||
def brands():
|
||||
year_id = request.args.get('year_id', type=int)
|
||||
def _do(master):
|
||||
data = catalog_service.get_brands(master)
|
||||
data = catalog_service.get_brands(master, year_id=year_id)
|
||||
return jsonify({'data': data})
|
||||
return _master_only(_do)
|
||||
|
||||
@@ -72,10 +73,11 @@ def brands():
|
||||
@require_auth('catalog.view')
|
||||
def models():
|
||||
brand_id = request.args.get('brand_id', type=int)
|
||||
year_id = request.args.get('year_id', type=int)
|
||||
if not brand_id:
|
||||
return jsonify({'error': 'brand_id required'}), 400
|
||||
def _do(master):
|
||||
data = catalog_service.get_models(master, brand_id)
|
||||
data = catalog_service.get_models(master, brand_id, year_id=year_id)
|
||||
return jsonify({'data': data})
|
||||
return _master_only(_do)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user