refactor(status): introduce OrderStatus enum, replace string literals

Centralized order status values in api/app/constants.py via a
str-valued Enum so comparisons keep working. Replaced literals in:
- services: sync_service, sqlite_service, retry_service
- routers: sync, dashboard
- templates: dashboard.html, logs.html
- static JS: shared (ORDER_STATUS mirror), dashboard, logs
- tests: requirements, order_items_overwrite, business_rules

MALFORMED intentionally NOT added — introduced in follow-up PR2
(per-order failure isolation).

Full test suite: 231 unit + 33 e2e pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-22 08:45:32 +00:00
parent 51790accf9
commit f6d283b743
14 changed files with 171 additions and 133 deletions

View File

@@ -35,6 +35,7 @@ if _api_dir not in sys.path:
from app import database
from app.services import sqlite_service
from app.constants import OrderStatus
@pytest.fixture(autouse=True)
@@ -69,7 +70,7 @@ async def _seed_order(order_number="TEST-001"):
order_number=order_number,
order_date="2026-01-01",
customer_name="Test",
status="IMPORTED",
status=OrderStatus.IMPORTED.value,
)
@@ -192,5 +193,5 @@ async def test_mark_order_deleted_removes_items():
finally:
await db.close()
assert row is not None
assert row["status"] == "DELETED_IN_ROA"
assert row["status"] == OrderStatus.DELETED_IN_ROA.value
assert row["id_comanda"] is None