Files
xenia-pos-local/local_backend/models/all.py
T
bonaminandClaude Opus 5.5 b7fda58af9 feat(backend): permission keys replace the 13 perm_* columns
Platform v2 step 1.5 (APPS_PLATFORM D-7, D-17, §3, §6.1).
- user_permissions(user_id, key); revision 0005 copies existing v1 flags into
  keys (frozen mapping) and drops the perm_* columns; can_cancel_orders gone
- core/access: check() = module effective + key held (superadmin implicit,
  override keys wired for 1.9); holds()/can(); markers require/require_any/
  public/require_device; role templates from manifests; queries.holders_filter
  replaces User.perm_x == True; legacy.py projects/accepts the v1 booleans
  for the current manager/waiter UIs only (§3.3, temporary)
- routers.deps: require_manager/... are now aliases of require("<key>");
  history endpoints use history.view; superadmin-only = core.system.admin;
  get_current_user carries the "signed_in" marker
- every inline perm_* read in routers/services converted to holds()
- staff API: permission catalogue by module with role templates, get/set a
  user's keys, reset to role template; legacy flag toggles still work; a
  non-superadmin can only grant keys they hold (access.cannot_grant)
- setup wizard creates the first account as owner (v1: store_manager, who
  couldn't change settings); demo/seed manager is owner
- roles.py keeps only the role list and labels
- guards: every route has an access marker (19 open routes marked public()
  on purpose; /waiters/roles now needs sign-in), no perm_* attribute reads
- tests: check matrix, templates, projection, staff permission API, grant
  guard, 0005 data copy; pack rule CS-14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 18:51:06 +02:00

32 lines
1.8 KiB
Python

"""Import every model module so Base.metadata knows the whole schema.
Used by main.py (app startup), migrations/env.py (Alembic autogenerate) and
the tests. Agent note: a new model module MUST be added here, or Alembic
autogenerate will not see it and the drift guard (tests/guards) will not
catch it either.
"""
import models.user # noqa: F401 also registers WaiterZone
import models.table # noqa: F401
import models.printer # noqa: F401
import models.product # noqa: F401
import models.customers # noqa: F401
import models.order # noqa: F401 also registers OrderAuditLog, OrderDiscount, PrintJob
import models.business_day # noqa: F401
import models.shift # noqa: F401 WaiterShift, ShiftBreak
import models.settings # noqa: F401
import models.flag # noqa: F401 TableFlagDef, TableFlagAssignment
import models.message # noqa: F401 StaffMessage, StaffMessageAck, QuickMessageTemplate
import models.reservation # noqa: F401
import models.notes # noqa: F401 SiteNote, SiteTodo
import models.expenses # noqa: F401 Contact, Expense, ExpensePayment
import models.tabs # noqa: F401 Tab, TabEntry, TabPayment
import models.waste # noqa: F401 WasteLog
import models.schedule # noqa: F401 ScheduledShift
import models.chat # noqa: F401 Conversation, ConversationParticipant, ChatMessage
import models.prep_zone # noqa: F401 PrepZone, prep_zone_printers, product_prep_zones
import models.pricing # noqa: F401 PriceGroup, PriceModifier, Deal, PriceEventLog, WaiterDiscountSettings
import models.recovery_code # noqa: F401
import models.sync_event # noqa: F401
import models.site_module # noqa: F401 SiteModule (module enablement, step 1.3)
import models.user_permission # noqa: F401 UserPermission (permission keys, step 1.5)