with open("/app/app/api/v1/endpoints/categories.py", "r") as f: content = f.read() old = ''' # ✅ CORREGIDO: Asignar tenant_id del usuario actual db_category = Category( **category.model_dump(), tenant_id=current_user.tenant_id # ✅ Multi-tenancy automático )''' new = ''' # ADMIN global puede especificar tenant_id; otros usan el suyo from app.models.user import UserRole as _R data = category.model_dump() if current_user.role == _R.ADMIN and data.get("tenant_id"): target_tenant_id = data["tenant_id"] else: target_tenant_id = current_user.tenant_id data["tenant_id"] = target_tenant_id db_category = Category(**data)''' if old in content: content = content.replace(old, new) print("OK: fix aplicado") else: print("ERROR: bloque no encontrado") with open("/app/app/api/v1/endpoints/categories.py", "w") as f: f.write(content)