feat: foundations for the manager conversion (platform-v2 step 6.1)
- Backend: every HTTPException in routers/ is an error code now (260 raises, ~105 new codes, texts in en + el); XeniaError(detail=...) keeps the three v1-shaped answers old pages read; bad / unknown tokens answer auth.session_ended; test_errors refuses new HTTPExceptions. - Manager: v2.json is the list of pages on the v2 rules: scripts/lint.mjs lints them, tests/v2-guards.test.mjs refuses Greek and colour literals, `strict` paths make set-state-in-effect an error. - src/live/useLiveQuery.js (react-query + live events + refresh on reconnect); Signed in now uses it. - Dead manager files removed (3.1k lines unreachable from main.jsx). - Tests: backend 544 passed, manager unit 33, run-all (no Android) passed (manager's live bell check passed on a rerun). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ DELETE /api/prep-zones/{id} delete a prep zone
|
||||
"""
|
||||
import json
|
||||
from core.i18n import normalize_language
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
@@ -18,6 +18,7 @@ from models.prep_zone import PrepZone
|
||||
from models.printer import Printer
|
||||
from routers.deps import require_manager
|
||||
from models.user import User
|
||||
from core.errors import XeniaError
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -155,7 +156,7 @@ def update_prep_zone(
|
||||
):
|
||||
zone = db.query(PrepZone).filter(PrepZone.id == zone_id).first()
|
||||
if not zone:
|
||||
raise HTTPException(status_code=404, detail="Prep zone not found")
|
||||
raise XeniaError("prep_zone.not_found")
|
||||
|
||||
if body.name is not None:
|
||||
zone.name = body.name
|
||||
@@ -216,7 +217,7 @@ def delete_prep_zone(
|
||||
):
|
||||
zone = db.query(PrepZone).filter(PrepZone.id == zone_id).first()
|
||||
if not zone:
|
||||
raise HTTPException(status_code=404, detail="Prep zone not found")
|
||||
raise XeniaError("prep_zone.not_found")
|
||||
db.delete(zone)
|
||||
db.commit()
|
||||
return {"ok": True}
|
||||
|
||||
Reference in New Issue
Block a user