From 0598c5f8e11804671c54ddb9a06812b52b934ce2 Mon Sep 17 00:00:00 2001 From: Repinoid Date: Wed, 10 Jun 2026 21:33:47 +0400 Subject: [PATCH] =?UTF-8?q?fix:=20PUT=20profile=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D1=91=D1=82=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8C?= =?UTF-8?q?=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B5=D0=B3=D0=BE=20=D0=BD=D0=B5?= =?UTF-8?q?=D1=82=20(upsert)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/routes.py b/api/routes.py index acfa2a0..e2aa4eb 100644 --- a/api/routes.py +++ b/api/routes.py @@ -318,12 +318,12 @@ def register(app): @app.route("/api/v1/elm/profile/", methods=["PUT"]) def update_elm_profile(mac: str): - """Обновляет поля профиля (response_time_ms, elm_desc и т.д.).""" + """Обновляет поля профиля (response_time_ms и т.д.). Если профиля нет — создаёт.''' data = request.get_json(silent=True) or {} with Database() as db: p = db.get_device_profile(mac) if p is None: - return jsonify({"error": "not found"}), 404 + p = {"mac": mac, "level": 0, "supported": [], "unsupported": [], "errors": []} p.update(data) _save_profile(mac, p) return jsonify({"ok": True})