fix(mappings): move sku/codmat from path to query — slash in keys 404'd

Codurile ROA contin legitim '/' si '"' (ex. RCR1/4"). Rutele FastAPI
foloseau parametri de cale (/api/mappings/{sku}/{codmat}...); ASGI decodeaza
%2F -> '/' INAINTE de routing, deci o cheie cu slash devine doua segmente si
Starlette nu mai potriveste ruta -> 404 la edit/delete/restore. Cand ambii
parametri au slash, un convertor {path} nu rezolva (split ambiguu).

Solutie: sku/codmat trec din cale in query string. %2F/%22 din query se
decodeaza ca parte a valorii, fara sa atinga routing-ul de cale.

- backend: 4 rute statice + Query(...) (update/edit/delete/restore);
  semnaturile mapping_service raman neschimbate
- frontend: helper mapQS(); toate cele 8 apeluri path -> query; cache-bust ?v=19
- tests: regresie ci-layer (chei-sentinel cu slash, !=404, toate 4 rutele);
  test_integration update/delete convertite la query; e2e delete RCR1/4"
  (slash+ghilimea) prin modalul UI, skip cand Oracle lipseste

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-06-08 13:58:04 +00:00
parent b1595f45c7
commit 550d94ff16
6 changed files with 130 additions and 21 deletions

View File

@@ -126,16 +126,17 @@ def test_mappings_list_after_create(client, real_codmat, test_sku):
def test_mappings_update(client, real_codmat, test_sku):
resp = client.put(f"/api/mappings/{test_sku}/{real_codmat}", json={
"cantitate_roa": 3.0,
})
resp = client.put("/api/mappings/update",
params={"sku": test_sku, "codmat": real_codmat},
json={"cantitate_roa": 3.0})
assert resp.status_code == 200
body = resp.json()
assert body.get("success") is True, f"update returned: {body}"
def test_mappings_delete(client, real_codmat, test_sku):
resp = client.delete(f"/api/mappings/{test_sku}/{real_codmat}")
resp = client.delete("/api/mappings/delete",
params={"sku": test_sku, "codmat": real_codmat})
assert resp.status_code == 200
body = resp.json()
assert body.get("success") is True, f"delete returned: {body}"