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:
2026-11-18 04:31:36 +02:00
co-authored by Claude Opus 5.5
parent 218a6c9c5e
commit 2dc5da446e
48 changed files with 918 additions and 3498 deletions
+5 -4
View File
@@ -1,7 +1,7 @@
from core.access.queries import holders_filter
from core.timeutil import to_venue, venue_day_window, venue_date
from datetime import date, datetime, timedelta, timezone
from fastapi import APIRouter, Depends, HTTPException, status, Query
from fastapi import APIRouter, Depends, status, Query
from sqlalchemy.orm import Session
from typing import List, Optional
@@ -11,6 +11,7 @@ from models.shift import WaiterShift
from models.user import User
from schemas.schedule import ScheduledShiftCreate, ScheduledShiftUpdate, ScheduledShiftOut
from routers.deps import require_manager
from core.errors import XeniaError
router = APIRouter()
@@ -74,7 +75,7 @@ def create_scheduled_shift(
):
target = db.query(User).filter(User.id == body.user_id, User.is_active == True).first()
if not target:
raise HTTPException(status_code=404, detail="User not found")
raise XeniaError("staff.not_found")
s = ScheduledShift(
user_id=body.user_id,
scheduled_date=body.scheduled_date,
@@ -98,7 +99,7 @@ def update_scheduled_shift(
):
s = db.query(ScheduledShift).filter(ScheduledShift.id == shift_id).first()
if not s:
raise HTTPException(status_code=404, detail="Scheduled shift not found")
raise XeniaError("schedule.shift_not_found")
for field, value in body.model_dump(exclude_none=True).items():
setattr(s, field, value)
db.commit()
@@ -114,7 +115,7 @@ def delete_scheduled_shift(
):
s = db.query(ScheduledShift).filter(ScheduledShift.id == shift_id).first()
if not s:
raise HTTPException(status_code=404, detail="Scheduled shift not found")
raise XeniaError("schedule.shift_not_found")
db.delete(s)
db.commit()